Conditions | 3 |
Paths | 3 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
31 | public function classToFileCandidates(ClassName $className): FilePathCandidates |
||
32 | { |
||
33 | $candidates = []; |
||
34 | $pattern = sprintf( |
||
35 | '{^.*/%s.php$}', |
||
36 | $className->name() |
||
37 | ); |
||
38 | |||
39 | $iterator = new RecursiveDirectoryIterator($this->cwd); |
||
40 | $iterator = new RecursiveIteratorIterator($iterator); |
||
41 | $iterator = new RegexIterator($iterator, $pattern); |
||
42 | |||
43 | foreach ($iterator as $phpFile) { |
||
44 | if (ClassName::fromString( |
||
45 | $this->classScanner->getClassNameFromFile($phpFile->getPathName()) |
||
46 | ) == $className) { |
||
47 | $candidates[] = FilePath::fromString($phpFile->getPathName()); |
||
48 | } |
||
49 | } |
||
50 | |||
51 | return FilePathCandidates::fromFilePaths($candidates); |
||
52 | } |
||
53 | } |
||
54 |