Conditions | 5 |
Paths | 7 |
Total Lines | 16 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
24 | public function removeDir($dir) { |
||
25 | if (! is_dir($dir)) { |
||
26 | throw new InvalidArgumentException("$dir must be a directory"); |
||
|
|||
27 | } |
||
28 | if (substr($dir, strlen($dir) - 1, 1) != '/') { |
||
29 | $dir .= '/'; |
||
30 | } |
||
31 | $files = glob($dir . '*', GLOB_MARK); |
||
32 | foreach ($files as $file) { |
||
33 | if (is_dir($file)) { |
||
34 | $this->removeDir($file); |
||
35 | } else { |
||
36 | $this->remove($file); |
||
37 | } |
||
38 | } |
||
39 | $this->remove($dir); |
||
40 | } |
||
42 |