/**
  * Constructor.
  *
  * @param Iterator $iterator    The Iterator to filter
  * @param array     $directories An array of directories to exclude
  */
 public function __construct(Iterator $iterator, array $directories)
 {
     foreach ($directories as $directory) {
         $this->patterns[] = '#(^|/)' . preg_quote($directory, '#') . '(/|$)#';
     }
     parent::__construct($iterator);
 }
 /**
  * Constructor.
  *
  * @param Iterator $iterator The Iterator to filter
  * @param array     $filters  An array of PHP callbacks
  *
  * @throws InvalidArgumentException
  */
 public function __construct(Iterator $iterator, array $filters)
 {
     foreach ($filters as $filter) {
         if (!is_callable($filter)) {
             throw new InvalidArgumentException('Invalid PHP callback.');
         }
     }
     $this->filters = $filters;
     parent::__construct($iterator);
 }
 /**
  * Constructor.
  *
  * @param Iterator $iterator        The Iterator to filter
  * @param array     $matchPatterns   An array of patterns that need to match
  * @param array     $noMatchPatterns An array of patterns that need to not match
  */
 public function __construct(Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
 {
     foreach ($matchPatterns as $pattern) {
         $this->matchRegexps[] = $this->toRegex($pattern);
     }
     foreach ($noMatchPatterns as $pattern) {
         $this->noMatchRegexps[] = $this->toRegex($pattern);
     }
     parent::__construct($iterator);
 }
 /**
  * Constructor.
  *
  * @param Iterator $iterator    The Iterator to filter
  * @param array     $directories An array of directories to exclude
  */
 public function __construct(Iterator $iterator, array $directories)
 {
     $this->iterator = $iterator;
     $this->isRecursive = $iterator instanceof RecursiveIterator;
     $patterns = array();
     foreach ($directories as $directory) {
         if (!$this->isRecursive || false !== strpos($directory, '/')) {
             $patterns[] = preg_quote($directory, '#');
         } else {
             $this->excludedDirs[$directory] = true;
         }
     }
     if ($patterns) {
         $this->excludedPattern = '#(?:^|/)(?:' . implode('|', $patterns) . ')(?:/|$)#';
     }
     parent::__construct($iterator);
 }
Exemplo n.º 5
0
 /**
  * Constructor.
  *
  * @param RecursiveIteratorIterator $iterator The Iterator to filter
  * @param int                       $minDepth The min depth
  * @param int                       $maxDepth The max depth
  */
 public function __construct(RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
 {
     $this->minDepth = $minDepth;
     $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
     parent::__construct($iterator);
 }
Exemplo n.º 6
0
 /**
  * Constructor.
  *
  * @param Iterator $iterator The Iterator to filter
  * @param int      $mode     The mode (self::ONLY_FILES or self::ONLY_DIRECTORIES)
  */
 public function __construct(Iterator $iterator, $mode)
 {
     $this->mode = $mode;
     parent::__construct($iterator);
 }
 /**
  * Constructor.
  *
  * @param Iterator          $iterator    The Iterator to filter
  * @param ehough_finder_comparator_NumberComparator[] $comparators An array of ehough_finder_comparator_NumberComparator instances
  */
 public function __construct(Iterator $iterator, array $comparators)
 {
     $this->comparators = $comparators;
     parent::__construct($iterator);
 }