| Total Complexity | 5 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | final class RecursiveRegexFinder extends Finder implements MigrationDeepFinder |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @return string[] |
||
| 18 | */ |
||
| 19 | 92 | public function findMigrations(string $directory, ?string $namespace = null) : array |
|
| 20 | { |
||
| 21 | 92 | $dir = $this->getRealPath($directory); |
|
| 22 | |||
| 23 | 90 | return $this->loadMigrations($this->getMatches($this->createIterator($dir)), $namespace); |
|
| 24 | } |
||
| 25 | |||
| 26 | 90 | private function createIterator(string $dir) : RegexIterator |
|
| 27 | { |
||
| 28 | 90 | return new RegexIterator( |
|
| 29 | 90 | new RecursiveIteratorIterator( |
|
| 30 | 90 | new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS | FilesystemIterator::FOLLOW_SYMLINKS), |
|
| 31 | 90 | RecursiveIteratorIterator::LEAVES_ONLY |
|
| 32 | ), |
||
| 33 | 90 | $this->getPattern(), |
|
| 34 | 90 | RegexIterator::GET_MATCH |
|
| 35 | ); |
||
| 36 | } |
||
| 37 | |||
| 38 | 90 | private function getPattern() : string |
|
| 44 | ); |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @return string[] |
||
| 49 | */ |
||
| 50 | 90 | private function getMatches(RegexIterator $iteratorFilesMatch) : array |
|
| 60 |