本文整理汇总了PHP中CList::mergeWith方法的典型用法代码示例。如果您正苦于以下问题:PHP CList::mergeWith方法的具体用法?PHP CList::mergeWith怎么用?PHP CList::mergeWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CList
的用法示例。
在下文中一共展示了CList::mergeWith方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStaticEventHandlersAll
private function getStaticEventHandlersAll($class, $event)
{
$inspectedClass = $class;
$eventHandlers = false;
do {
$additionalEventHandlers = $this->getStaticEventHandlersStrict($inspectedClass, $event);
if ($additionalEventHandlers !== false) {
if ($eventHandlers === false) {
$eventHandlers = new CList();
$eventHandlers->copyFrom($additionalEventHandlers);
} else {
$eventHandlers->mergeWith($additionalEventHandlers);
}
}
$inspectedClass = get_parent_class($inspectedClass);
} while ($inspectedClass !== false && $this->componentHasEvent($inspectedClass, $event));
return $eventHandlers;
}
示例2: findRecursive
public static function findRecursive($dir, $filters = NULL, $depth = -1, $limit = 0)
{
if (!$filters instanceof EFileFilters) {
$filters = new EFileFilters($filters);
}
$list = new CList();
//TODO: $dir = new DirectoryIterator(dirname(__FILE__)); foreach ($dir as $fileinfo) {}
$handle = opendir($dir);
while (($fileName = readdir($handle)) !== FALSE) {
if ($limit > 0 && $list->count >= $limit) {
break;
}
if ($fileName === '.' || $fileName === '..') {
continue;
}
$file = EFile::getInstance($dir . DIRECTORY_SEPARATOR . $fileName);
//TODO: подумать о сортировке прямо в цикле поиска
if ($filters->run($file)) {
if ($file->isDir && $depth) {
$list->mergeWith(self::findRecursive($file->path, $filters, $depth - 1, $limit - $list->count));
} else {
$list->add($file);
}
}
}
closedir($handle);
return $list;
}