Conditions | 6 |
Paths | 6 |
Total Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 6.0087 |
Changes | 0 |
1 | <?php declare(strict_types = 1); |
||
36 | 1 | public function ls(string $path): array |
|
37 | { |
||
38 | 1 | $files = []; |
|
39 | 1 | $d = dir($path); |
|
40 | 1 | while (false !== ($entry = $d->read())) { |
|
41 | 1 | if (in_array($entry, ['.', '..'], true)) { |
|
42 | 1 | continue; |
|
43 | } |
||
44 | 1 | $entryPath = $path . $entry; |
|
45 | 1 | if (is_dir($entryPath)) { |
|
46 | 1 | foreach ($this->ls($entryPath . DIRECTORY_SEPARATOR) as $entryPath) { |
|
47 | 1 | $files[] = $entryPath; |
|
48 | } |
||
49 | 1 | continue; |
|
50 | } |
||
51 | 1 | if (!is_file($entryPath)) { |
|
52 | continue; |
||
53 | } |
||
54 | 1 | $files[] = $entryPath; |
|
55 | } |
||
56 | 1 | $d->close(); |
|
57 | |||
58 | 1 | return $files; |
|
59 | } |
||
60 | } |
||
61 |