Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
36 | public function delete(string $path = null) |
||
37 | { |
||
38 | $folder = $path ?? $this->path; |
||
39 | |||
40 | $files = array_diff(scandir($folder), array('.', '..')); |
||
41 | |||
42 | foreach ($files as $file) { |
||
43 | |||
44 | $item = "$folder/$file"; |
||
45 | |||
46 | is_dir($item) ? $this->delete($item) : unlink($item); |
||
47 | } |
||
48 | |||
49 | return rmdir($folder); |
||
50 | } |
||
62 | } |