当前位置: 首页>>代码示例>>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;未经允许,请勿转载。