| 1 | <?php |
||
| 10 | class Finder |
||
| 11 | { |
||
| 12 | private Filesystem |
||
|
|
|||
| 13 | $fs; |
||
| 14 | |||
| 15 | 88 | public function __construct(Filesystem $fs) |
|
| 16 | { |
||
| 17 | 88 | $this->fs = $fs; |
|
| 18 | 88 | } |
|
| 19 | |||
| 20 | 86 | public function findFiles(string $regex): iterable |
|
| 21 | { |
||
| 22 | 86 | return new FileFilterIterator( |
|
| 23 | 86 | new \ArrayIterator($this->fs->keys()), |
|
| 24 | $regex, |
||
| 25 | 86 | $this->fs |
|
| 26 | ); |
||
| 27 | } |
||
| 28 | } |
||
| 29 |