Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
18 | 1 | public function streamSafeGlob($directory, $filePattern) : array { |
|
19 | 1 | $files = scandir($directory); |
|
20 | 1 | $found = []; |
|
21 | |||
22 | 1 | foreach ($files as $filename) { |
|
23 | 1 | if (in_array($filename, ['.', '..'])) { |
|
24 | 1 | continue; |
|
25 | } |
||
26 | |||
27 | 1 | if (fnmatch($filePattern, $filename)) { |
|
28 | 1 | $found[] = "{$directory}/{$filename}"; |
|
29 | } |
||
30 | } |
||
31 | |||
32 | 1 | return $found; |
|
33 | } |
||
34 | } |