fix git dir creation
[phorkie.git] / src / phorkie / Tools.php
1 <?php
2 namespace phorkie;
3
4
5 class Tools
6 {
7     public static function recursiveDelete($path)
8     {
9         if (!is_dir($path) || is_link($path)) {
10             return unlink($path);
11         }
12         foreach (scandir($path) as $file) {
13             if ($file == '.' || $file == '..') {
14                 continue;
15             }
16             $filepath = $path . DIRECTORY_SEPARATOR . $file;
17             if (!static::recursiveDelete($filepath)) {
18                 return false;
19             };
20         }
21         return rmdir($path);
22     }
23
24 }
25
26 ?>