| Total Complexity | 11 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | final class Directory |
||
| 9 | { |
||
| 10 | public function all(string $path): DirectoryIterator |
||
| 17 | } |
||
| 18 | |||
| 19 | public function names(string $path): array |
||
| 20 | { |
||
| 21 | $items = []; |
||
| 22 | |||
| 23 | foreach ($this->all($path) as $directory) { |
||
| 24 | if ($directory->isDir() && ! $directory->isDot()) { |
||
| 25 | $items[] = $directory->getFilename(); |
||
| 26 | } |
||
| 27 | } |
||
| 28 | |||
| 29 | sort($items); |
||
| 30 | |||
| 31 | return array_values($items); |
||
| 32 | } |
||
| 33 | |||
| 34 | public function make(string $path, int $mode = 755): bool |
||
| 35 | { |
||
| 36 | if ($this->doesntExist($path)) { |
||
| 37 | return mkdir($path, $mode, true); |
||
| 38 | } |
||
| 39 | |||
| 40 | return true; |
||
| 41 | } |
||
| 42 | |||
| 43 | public function exists(string $path): bool |
||
| 46 | } |
||
| 47 | |||
| 48 | public function doesntExist(string $path): bool |
||
| 51 | } |
||
| 52 | } |
||
| 53 |