| Conditions | 4 |
| Paths | 4 |
| Total Lines | 26 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | 4 | public function find(array $source) : array |
|
| 20 | { |
||
| 21 | 4 | $files = []; |
|
| 22 | |||
| 23 | 4 | foreach ($source as $singleSource) { |
|
| 24 | 4 | if (is_file($singleSource)) { |
|
| 25 | 2 | $fileInfo = new SplFileInfo($singleSource); |
|
| 26 | 2 | if ($fileInfo->getExtension() !== 'php') { |
|
| 27 | 1 | continue; |
|
| 28 | } |
||
| 29 | |||
| 30 | 1 | $files[$singleSource] = $fileInfo; |
|
| 31 | } else { |
||
| 32 | 2 | $finder = (new Finder())->files() |
|
| 33 | 2 | ->name('*.php') |
|
| 34 | 2 | ->in($singleSource); |
|
| 35 | |||
| 36 | 2 | $files = array_merge( |
|
| 37 | $files, |
||
| 38 | 3 | iterator_to_array($finder->getIterator()) |
|
| 39 | ); |
||
| 40 | } |
||
| 41 | } |
||
| 42 | |||
| 43 | 4 | return $files; |
|
| 44 | } |
||
| 45 | } |
||
| 46 |