本文整理汇总了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);
}
}
示例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());
});
}
示例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.');
}
示例4: getClassChildren
/**
* @param boolean|null $includeAbstracts
* @return string[]
*/
public static function getClassChildren($includeAbstracts = null)
{
$className = get_called_class();
return CM_Util::getClassChildren($className, $includeAbstracts);
}
示例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;
}
}
}