CRM-15735 fix - Update payment status for pay-later membership renewal ignores Receiv...
[civicrm-core.git] / CRM / Core / Component.php
index 05527ef8bde63d58231cbb37faff94ca277f00dd..85c69308675466cdbdfeec609a8ae5ea497de122 100644 (file)
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  * Component stores all the static and dynamic information of the various
@@ -99,7 +99,7 @@ class CRM_Core_Component {
       $cr->find(FALSE);
       while ($cr->fetch()) {
         $infoClass = $cr->namespace . '_' . self::COMPONENT_INFO_CLASS;
-        require_once (str_replace('_', DIRECTORY_SEPARATOR, $infoClass) . '.php');
+        require_once str_replace('_', DIRECTORY_SEPARATOR, $infoClass) . '.php';
         $infoObject = new $infoClass($cr->name, $cr->namespace, $cr->id);
         if ($infoObject->info['name'] !== $cr->name) {
           CRM_Core_Error::fatal("There is a discrepancy between name in component registry and in info file ({$cr->name}).");
@@ -230,7 +230,7 @@ class CRM_Core_Component {
       $cfg = $comp->getConfigObject();
       $cfg->add($config, $oldMode);
     }
-    return;
+    return NULL;
   }
 
   /**
@@ -275,8 +275,8 @@ class CRM_Core_Component {
     $fields = array();
     foreach ($info as $name => $comp) {
       if ($comp->usesSearch()) {
-        $bqr    = $comp->getBAOQueryObject();
-        $flds   = $bqr->getFields();
+        $bqr = $comp->getBAOQueryObject();
+        $flds = $bqr->getFields();
         $fields = array_merge($fields, $flds);
       }
     }
@@ -327,7 +327,8 @@ class CRM_Core_Component {
    *
    * @return null
    */
-  static function &defaultReturnProperties($mode,
+  public static function &defaultReturnProperties(
+    $mode,
     $includeCustomFields = TRUE
   ) {
     $info = self::_info();
@@ -419,10 +420,9 @@ class CRM_Core_Component {
   /**
    * Handle table dependencies of components
    *
-   * @param array $tables  array of tables
+   * @param array $tables
+   *   Array of tables.
    *
-   * @return null
-   * @static
    */
   public static function tableNames(&$tables) {
     $info = self::_info();
@@ -437,13 +437,11 @@ class CRM_Core_Component {
 
   /**
    * Get components info from info file
-   *
    */
   public static function getComponentsFromFile($crmFolderDir) {
     $components = array();
     //traverse CRM folder and check for Info file
-    if (is_dir($crmFolderDir)) {
-      $dir = opendir($crmFolderDir);
+    if (is_dir($crmFolderDir) && $dir = opendir($crmFolderDir)) {
       while ($subDir = readdir($dir)) {
         // skip the extensions diretory since it has an Info.php file also
         if ($subDir == 'Extension') {
@@ -453,7 +451,7 @@ class CRM_Core_Component {
         $infoFile = $crmFolderDir . "/{$subDir}/" . self::COMPONENT_INFO_CLASS . '.php';
         if (file_exists($infoFile)) {
           $infoClass = 'CRM_' . $subDir . '_' . self::COMPONENT_INFO_CLASS;
-          require_once (str_replace('_', DIRECTORY_SEPARATOR, $infoClass) . '.php');
+          require_once str_replace('_', DIRECTORY_SEPARATOR, $infoClass) . '.php';
           $infoObject = new $infoClass(NULL, NULL, NULL);
           $components[$infoObject->info['name']] = $infoObject;
           unset($infoObject);
@@ -463,5 +461,5 @@ class CRM_Core_Component {
 
     return $components;
   }
-}
 
+}