X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FComponent.php;h=9f3dfdac435e3c62ff374932dd8eaa3adf912116;hb=b5a59dbd69f7fdb6a7f96b541392be59f3ccac9f;hp=7d8b051f419a5fa846c394e0f2a1bbb308b2def6;hpb=6b83d5bdd0f2ca546924feae6aa42aeddb1d40cf;p=civicrm-core.git diff --git a/CRM/Core/Component.php b/CRM/Core/Component.php index 7d8b051f41..9f3dfdac43 100644 --- a/CRM/Core/Component.php +++ b/CRM/Core/Component.php @@ -42,7 +42,10 @@ class CRM_Core_Component { */ const COMPONENT_INFO_CLASS = 'Info'; - static $_contactSubTypes = NULL; + /** + * @var array + */ + public static $_contactSubTypes = NULL; /** * @param bool $force @@ -51,8 +54,8 @@ class CRM_Core_Component { */ private static function &_info($force = FALSE) { if (!isset(Civi::$statics[__CLASS__]['info'])|| $force) { - Civi::$statics[__CLASS__]['info'] = array(); - $c = array(); + Civi::$statics[__CLASS__]['info'] = []; + $c = []; $config = CRM_Core_Config::singleton(); $c = self::getComponents(); @@ -89,7 +92,7 @@ class CRM_Core_Component { */ public static function &getComponents($force = FALSE) { if (!isset(Civi::$statics[__CLASS__]['all']) || $force) { - Civi::$statics[__CLASS__]['all'] = array(); + Civi::$statics[__CLASS__]['all'] = []; $cr = new CRM_Core_DAO_Component(); $cr->find(FALSE); @@ -117,7 +120,7 @@ class CRM_Core_Component { * Array(string $name => int $id). */ public static function &getComponentIDs() { - $componentIDs = array(); + $componentIDs = []; $cr = new CRM_Core_DAO_Component(); $cr->find(FALSE); @@ -128,17 +131,16 @@ class CRM_Core_Component { return $componentIDs; } - /** * @param bool $force * * @return CRM_Core_Component_Info[] */ - static public function &getEnabledComponents($force = FALSE) { + public static function &getEnabledComponents($force = FALSE) { return self::_info($force); } - static public function flushEnabledComponents() { + public static function flushEnabledComponents() { unset(Civi::$statics[__CLASS__]); } @@ -150,7 +152,7 @@ class CRM_Core_Component { public static function &getNames($translated = FALSE) { $allComponents = self::getComponents(); - $names = array(); + $names = []; foreach ($allComponents as $name => $comp) { if ($translated) { $names[$comp->componentID] = $comp->info['translatedName']; @@ -208,7 +210,7 @@ class CRM_Core_Component { // lets build the menu for all components $info = self::getComponents(TRUE); - $files = array(); + $files = []; foreach ($info as $name => $comp) { $files = array_merge($files, $comp->menuFiles() @@ -223,7 +225,7 @@ class CRM_Core_Component { */ public static function &menu() { $info = self::_info(); - $items = array(); + $items = []; foreach ($info as $name => $comp) { $mnu = $comp->getMenuObject(); @@ -275,7 +277,7 @@ class CRM_Core_Component { */ public static function &getQueryFields($checkPermission = TRUE) { $info = self::_info(); - $fields = array(); + $fields = []; foreach ($info as $name => $comp) { if ($comp->usesSearch()) { $bqr = $comp->getBAOQueryObject(); @@ -383,12 +385,11 @@ class CRM_Core_Component { */ public static function &contactSubTypes() { if (self::$_contactSubTypes == NULL) { - self::$_contactSubTypes = array(); + self::$_contactSubTypes = []; } return self::$_contactSubTypes; } - /** * @param $subType * @param $op @@ -431,7 +432,7 @@ class CRM_Core_Component { * @return array */ public static function getComponentsFromFile($crmFolderDir) { - $components = array(); + $components = []; //traverse CRM folder and check for Info file if (is_dir($crmFolderDir) && $dir = opendir($crmFolderDir)) { while ($subDir = readdir($dir)) {