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