| 1 | <?php |
||
| 15 | trait FilterTrait |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * Get a recursor/iterator filters on the name of the objects it works on. |
||
| 19 | * |
||
| 20 | * The regexp will be embedded as such "%^$regexp$%" before it is passed |
||
| 21 | * to preg_match. |
||
| 22 | */ |
||
| 23 | 6 | public function named(string $regexp) |
|
| 30 | |||
| 31 | /** |
||
| 32 | * Get an iterator for every directory in the current iterator. |
||
| 33 | */ |
||
| 34 | 2 | public function directoriesOnly() : Iterator |
|
| 40 | |||
| 41 | /** |
||
| 42 | * Get an iterator for every file in the current iterator. |
||
| 43 | */ |
||
| 44 | 2 | public function filesOnly() : Iterator |
|
| 50 | |||
| 51 | /** |
||
| 52 | * This should actually return a filtered version of the object. |
||
| 53 | * |
||
| 54 | * @param \Closure $predicate |
||
| 55 | * @return mixed |
||
| 56 | */ |
||
| 57 | abstract public function filter(\Closure $predicate); |
||
| 58 | } |
||
| 59 |