Conditions | 5 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
9 | 4 | public static function getFilesInDirectory($dir) |
|
10 | { |
||
11 | 4 | $iterator = new DirectoryIterator($dir); |
|
12 | 4 | $files = []; |
|
13 | |||
14 | 4 | foreach ($iterator as $file) { |
|
15 | 4 | if ($file->getFilename() === '.' || $file->getFilename() === '..') { |
|
16 | 4 | continue; |
|
17 | } |
||
18 | |||
19 | 4 | if (is_dir($file->getPathname())) { |
|
20 | 3 | $files = array_merge($files, self::getFilesInDirectory($file->getPathname())); |
|
21 | 3 | } else { |
|
22 | 4 | $files[] = realpath($file->getPathname()); |
|
23 | } |
||
24 | 4 | } |
|
25 | |||
26 | 4 | sort($files); |
|
27 | |||
28 | 4 | return $files; |
|
29 | } |
||
30 | |||
53 |