| Conditions | 6 |
| Paths | 5 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 3 |
| CRAP Score | 21.1875 |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | 1 | public static function recursiveDelete(string $src) |
|
| 10 | { |
||
| 11 | 1 | if (!is_dir($src)) { |
|
| 12 | 1 | throw new BitcoindException("Parameter 1 for recursiveDelete should be a directory"); |
|
| 13 | } |
||
| 14 | |||
| 15 | $dir = opendir($src); |
||
| 16 | while (false !== ( $file = readdir($dir))) { |
||
|
|
|||
| 17 | if (( $file != '.' ) && ( $file != '..' )) { |
||
| 18 | $full = $src . '/' . $file; |
||
| 19 | if (is_dir($full)) { |
||
| 20 | self::recursiveDelete($full); |
||
| 21 | } else { |
||
| 22 | unlink($full); |
||
| 23 | } |
||
| 24 | } |
||
| 25 | } |
||
| 26 | closedir($dir); |
||
| 27 | rmdir($src); |
||
| 28 | } |
||
| 30 |