Вход Регистрация
Файл: concrete5.7.5.6/concrete/vendor/symfony/finder/Symfony/Component/Finder/Adapter/PhpAdapter.php
Строк: 83
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace SymfonyComponentFinderAdapter;

use 
SymfonyComponentFinderIterator;

/**
 * PHP finder engine implementation.
 *
 * @author Jean-François Simon <contact@jfsimon.fr>
 */
class PhpAdapter extends AbstractAdapter
{
    
/**
     * {@inheritdoc}
     */
    
public function searchInDirectory($dir)
    {
        
$flags RecursiveDirectoryIterator::SKIP_DOTS;

        if (
$this->followLinks) {
            
$flags |= RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
        }

        
$iterator = new RecursiveIteratorIterator(
            new 
IteratorRecursiveDirectoryIterator($dir$flags$this->ignoreUnreadableDirs),
            
RecursiveIteratorIterator::SELF_FIRST
        
);

        if (
$this->minDepth || $this->maxDepth PHP_INT_MAX) {
            
$iterator = new IteratorDepthRangeFilterIterator($iterator$this->minDepth$this->maxDepth);
        }

        if (
$this->mode) {
            
$iterator = new IteratorFileTypeFilterIterator($iterator$this->mode);
        }

        if (
$this->exclude) {
            
$iterator = new IteratorExcludeDirectoryFilterIterator($iterator$this->exclude);
        }

        if (
$this->names || $this->notNames) {
            
$iterator = new IteratorFilenameFilterIterator($iterator$this->names$this->notNames);
        }

        if (
$this->contains || $this->notContains) {
            
$iterator = new IteratorFilecontentFilterIterator($iterator$this->contains$this->notContains);
        }

        if (
$this->sizes) {
            
$iterator = new IteratorSizeRangeFilterIterator($iterator$this->sizes);
        }

        if (
$this->dates) {
            
$iterator = new IteratorDateRangeFilterIterator($iterator$this->dates);
        }

        if (
$this->filters) {
            
$iterator = new IteratorCustomFilterIterator($iterator$this->filters);
        }

        if (
$this->sort) {
            
$iteratorAggregate = new IteratorSortableIterator($iterator$this->sort);
            
$iterator $iteratorAggregate->getIterator();
        }

        if (
$this->paths || $this->notPaths) {
            
$iterator = new IteratorPathFilterIterator($iterator$this->paths$this->notPaths);
        }

        return 
$iterator;
    }

    
/**
     * {@inheritdoc}
     */
    
public function getName()
    {
        return 
'php';
    }

    
/**
     * {@inheritdoc}
     */
    
protected function canBeUsed()
    {
        return 
true;
    }
}
Онлайн: 0
Реклама