diff options
Diffstat (limited to 'src/phorkie/Tools.php')
| -rw-r--r-- | src/phorkie/Tools.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/phorkie/Tools.php b/src/phorkie/Tools.php new file mode 100644 index 0000000..c6e4db5 --- /dev/null +++ b/src/phorkie/Tools.php @@ -0,0 +1,26 @@ +<?php +namespace phorkie; + + +class Tools +{ + public static function recursiveDelete($path) + { + if (!is_dir($path) || is_link($path)) { + return unlink($path); + } + foreach (scandir($path) as $file) { + if ($file == '.' || $file == '..') { + continue; + } + $filepath = $path . DIRECTORY_SEPARATOR . $file; + if (!static::recursiveDelete($filepath)) { + return false; + }; + } + return rmdir($path); + } + +} + +?>
\ No newline at end of file |
