Conditions | 3 |
Paths | 4 |
Total Lines | 25 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
74 | protected function getSourcesFromFinder($source) |
||
75 | { |
||
76 | $array = explode(DIRECTORY_SEPARATOR, $source); |
||
77 | $filename = array_pop($array); |
||
78 | $directory = $source; |
||
79 | $pattern = '*'; |
||
80 | |||
81 | // if a dot is present, the last part is the filename pattern |
||
82 | if (strstr($filename, '.') !== false) { |
||
83 | $pattern = $filename; |
||
84 | $directory = implode('/', $array); |
||
85 | } |
||
86 | $finder = new Finder(); |
||
87 | $finder |
||
88 | ->name($pattern) |
||
89 | ->in($directory); |
||
90 | |||
91 | $sources = []; |
||
92 | |||
93 | foreach ($finder as $source) { |
||
94 | $sources[] = $source; |
||
95 | } |
||
96 | |||
97 | return $sources; |
||
98 | } |
||
99 | } |
||
100 |