Conditions | 7 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
27 | public static function removeRecursively($path): void |
||
28 | { |
||
29 | if (\file_exists($path)) { |
||
30 | $dir = \opendir($path); |
||
31 | if (\is_resource($dir)) { |
||
32 | while (false !== ($file = \readdir($dir))) { |
||
33 | if (($file !== self::$rootPath) && ($file !== self::$parentPath)) { |
||
34 | $full = $path . DIRECTORY_SEPARATOR . $file; |
||
35 | if (\is_dir($full)) { |
||
36 | self::removeRecursively($full); |
||
37 | } else { |
||
38 | \unlink($full); |
||
39 | } |
||
40 | } |
||
41 | } |
||
42 | \closedir($dir); |
||
43 | } |
||
44 | \rmdir($path); |
||
45 | } |
||
62 | } |