當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CM_Util::getClassChildren方法代碼示例

本文整理匯總了PHP中CM_Util::getClassChildren方法的典型用法代碼示例。如果您正苦於以下問題:PHP CM_Util::getClassChildren方法的具體用法?PHP CM_Util::getClassChildren怎麽用?PHP CM_Util::getClassChildren使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CM_Util的用法示例。


在下文中一共展示了CM_Util::getClassChildren方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: autoloadCommands

 public function autoloadCommands()
 {
     $classes = CM_Util::getClassChildren('CM_Cli_Runnable_Abstract', false);
     foreach ($classes as $className) {
         $this->addRunnable($className);
     }
 }
開發者ID:NicolasSchmutz,項目名稱:cm,代碼行數:7,代碼來源:CommandManager.php

示例2: getTypes

 /**
  * @return CM_Elasticsearch_Type_Abstract[]
  */
 public function getTypes()
 {
     $types = CM_Util::getClassChildren('CM_Elasticsearch_Type_Abstract');
     return \Functional\map($types, function ($className) {
         return new $className($this->getRandomClient());
     });
 }
開發者ID:NicolasSchmutz,項目名稱:cm,代碼行數:10,代碼來源:Cluster.php

示例3: clear

 public function clear()
 {
     $this->_getStreamOutput()->writeln('Clearing cache…');
     $classes = CM_Util::getClassChildren('CM_Cache_Storage_Abstract', false);
     foreach ($classes as $className) {
         $this->_getStreamOutput()->writeln('  ' . $className);
         /** @var CM_Cache_Storage_Abstract $cache */
         $cache = new $className();
         $cache->flush();
     }
     $this->_getStreamOutput()->writeln('Cache cleared.');
 }
開發者ID:cargomedia,項目名稱:cm,代碼行數:12,代碼來源:Cli.php

示例4: getClassChildren

 /**
  * @param boolean|null $includeAbstracts
  * @return string[]
  */
 public static function getClassChildren($includeAbstracts = null)
 {
     $className = get_called_class();
     return CM_Util::getClassChildren($className, $includeAbstracts);
 }
開發者ID:NicolasSchmutz,項目名稱:cm,代碼行數:9,代碼來源:Abstract.php

示例5: generateClassTypes

 public function generateClassTypes()
 {
     $config = CM_Config::get();
     if (isset(CM_Config::get()->CM_Class_Abstract->typesMaxValue)) {
         $this->_typesMaxValue = CM_Config::get()->CM_Class_Abstract->typesMaxValue;
     }
     $typedClasses = CM_Util::getClassChildren('CM_Typed', true);
     /** @var CM_Class_Abstract[]|string[] $namespaceClassList */
     $namespaceClassList = array();
     // fetch type-namespaces
     foreach ($typedClasses as $class) {
         if (!is_subclass_of(get_parent_class($class), 'CM_Typed')) {
             $namespaceClassList[] = $class;
         }
     }
     // fetch current types
     foreach ($namespaceClassList as $namespaceClass) {
         if (isset($config->{$namespaceClass}->types)) {
             foreach ($config->{$namespaceClass}->types as $type => $class) {
                 if ($classNameDuplicate = array_search($type, $this->_classTypes)) {
                     throw new CM_Exception_Invalid('Duplicate `TYPE` constant for `' . $class . '` and `' . $classNameDuplicate . '`. Both equal `' . $type . '`.');
                 }
                 if (class_exists($class)) {
                     $this->_classTypes[$type] = $class;
                 } else {
                     $this->_classTypesRemoved[] = $class;
                 }
             }
         }
     }
     // generate new types
     foreach ($namespaceClassList as $namespaceClass) {
         $this->_namespaceTypes[$namespaceClass] = array();
         $containedClasses = $namespaceClass::getClassChildren();
         $reflectionClass = new ReflectionClass($namespaceClass);
         if (!$reflectionClass->isAbstract()) {
             array_unshift($containedClasses, $namespaceClass);
         }
         foreach ($containedClasses as $class) {
             if (false === ($type = array_search($class, $this->_classTypes))) {
                 $type = ++$this->_typesMaxValue;
                 $this->_classTypes[$type] = $class;
                 $this->_classTypesAdded[$type] = $class;
             }
             $this->_namespaceTypes[$namespaceClass][$type] = $class;
         }
     }
 }
開發者ID:NicolasSchmutz,項目名稱:cm,代碼行數:48,代碼來源:Generator.php


注:本文中的CM_Util::getClassChildren方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。