Conditions | 6 |
Paths | 5 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 6.0131 |
Changes | 0 |
1 | <?php |
||
31 | 1 | public static function deleteFilesInDirectoryRecursively($dir) |
|
32 | { |
||
33 | 1 | if (!is_dir($dir)) { |
|
34 | return; |
||
35 | } |
||
36 | |||
37 | 1 | $iterator = new DirectoryIterator($dir); |
|
38 | |||
39 | 1 | foreach ($iterator as $file) { |
|
40 | 1 | if ($file->getFilename() === '.' || $file->getFilename() === '..') { |
|
41 | 1 | continue; |
|
42 | } |
||
43 | |||
44 | 1 | if (is_dir($file->getPathname())) { |
|
45 | 1 | self::deleteFilesInDirectoryRecursively($file->getPathname()); |
|
46 | 1 | rmdir($file->getPathname()); |
|
47 | 1 | } else { |
|
48 | 1 | unlink($file->getPathname()); |
|
49 | } |
||
50 | 1 | } |
|
51 | 1 | } |
|
52 | } |
||
53 |