PathFilterIterator
extends MultiplePcreFilterIterator
in package
PathFilterIterator filters files by path patterns (e.g. some/special/dir).
Tags
Table of Contents
Properties
- $matchRegexps : mixed
- $noMatchRegexps : mixed
Methods
- __construct() : mixed
- accept() : bool
- Filters the iterator values.
- isAccepted() : bool
- Checks whether the string is accepted by the regex filters.
- isRegex() : bool
- Checks whether the string is a regex.
- toRegex() : string
- Converts strings to regexp.
Properties
$matchRegexps
protected
mixed
$matchRegexps
= []
$noMatchRegexps
protected
mixed
$noMatchRegexps
= []
Methods
__construct()
public
__construct(Iterator<TKey, TValue> $iterator, array<string|int, string> $matchPatterns, array<string|int, string> $noMatchPatterns) : mixed
Parameters
- $iterator : Iterator<TKey, TValue>
-
The Iterator to filter
- $matchPatterns : array<string|int, string>
-
An array of patterns that need to match
- $noMatchPatterns : array<string|int, string>
-
An array of patterns that need to not match
accept()
Filters the iterator values.
public
accept() : bool
Return values
boolisAccepted()
Checks whether the string is accepted by the regex filters.
protected
isAccepted(string $string) : bool
If there is no regexps defined in the class, this method will accept the string. Such case can be handled by child classes before calling the method if they want to apply a different behavior.
Parameters
- $string : string
Return values
boolisRegex()
Checks whether the string is a regex.
protected
isRegex(string $str) : bool
Parameters
- $str : string
Return values
booltoRegex()
Converts strings to regexp.
protected
toRegex(string $str) : string
PCRE patterns are left unchanged.
Default conversion: 'lorem/ipsum/dolor' ==> 'lorem/ipsum/dolor/'
Use only / as directory separator (on Windows also).
Parameters
- $str : string
-
Pattern: regexp or dirname