本文整理匯總了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;
}