/** * Returns a regex iterator instance, starting from $dir applying the given * $pattern. * * @param string $directory * @param regex $pattern * @return \RegexIterator */ public function __construct($directory, $pattern) { $iterator = new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator($directory) ); parent::__construct($iterator, $pattern); }
function __construct($file = ".*", $path = ".", $recursive = false) { $path = !$path || $path === '' ? '.' : $path; $dirIt = new RecursiveDirectoryIterator($path); if ($recursive) { $theIt = new RecursiveIteratorIterator($dirIt); } else { $theIt = new IteratorIterator($dirIt); } // $iterator = new RegexIterator($theIt, '/\\\\'.$file.'/' ,RecursiveRegexIterator::GET_MATCH); parent::__construct($theIt, '/\\\\' . $file . '/', RecursiveRegexIterator::GET_MATCH); }
/** * ( excerpt from * http://docs.hhvm.com/manual/en/recursiveregexiterator.construct.php ) * * Creates a new regular expression iterator. * * @iterator mixed The recursive iterator to apply this regex filter * to. * @regex mixed The regular expression to match. * @mode mixed Operation mode, see RegexIterator::setMode() for a * list of modes. * @flags mixed Special flags, see RegexIterator::setFlags() for a * list of available flags. * @preg_flags mixed The regular expression flags. These flags depend on * the operation mode parameter: * - RecursiveRegexIterator::ALL_MATCHES: See preg_match_all(). * - RecursiveRegexIterator::GET_MATCH: See preg_match(). * - RecursiveRegexIterator::MATCH: See preg_match(). * - RecursiveRegexIterator::REPLACE: none. * - RecursiveRegexIterator::SPLIT: See preg_split(). */ public function __construct(RecursiveIterator $iterator, $regex, $mode = self::MATCH, $flags = 0, $preg_flags = 0) { parent::__construct($iterator, $regex, $mode, $flags, $preg_flags); }
/** * FilesystemRegexIterator constructor. * * @param Iterator $iterator * @param string $regex */ public function __construct(Iterator $iterator, string $regex) { $this->regex = $regex; parent::__construct($iterator, $regex); }
function __construct($it, $re, $mode, $flags = 0) { $this->uk = $flags & self::USE_KEY; $this->re = $re; parent::__construct($it, $re, $mode, $flags); }
/** * @param \Iterator $iterator * @param string $regex * @param int $mode optional * @param int $flags optional * @param int $preg_flags optional */ public function __construct(\Iterator $iterator, $regex, $mode = null, $flags = null, $preg_flags = null) { parent::__construct($iterator, $regex, $mode, $flags, $preg_flags); $this->_regex = $regex; }
public function __construct($path, $extension) { $dir = new \RecursiveDirectoryIterator($path); $iterator = new \RecursiveIteratorIterator($dir); parent::__construct($iterator, '/^.+\\.' . $extension . '$/i', \RecursiveRegexIterator::GET_MATCH); }