1 | <?php |
||
13 | /** |
||
14 | * Recursively deletes directory contents |
||
15 | * |
||
16 | * @param string $directoryPath absolute path of directory |
||
17 | * |
||
18 | * @return void |
||
19 | * |
||
20 | * @throws \Exception if file cannot be deleted |
||
21 | * @throws \Exception if directory cannot be deleted |
||
22 | * @throws \Exception if $directoryPath cannot be listed |
||
23 | */ |
||
24 | public static function deleteDirectoryContents(string $directoryPath) |
||
50 | |||
51 | /** |
||
52 | * Deletes the given file specified by $path |
||
53 | * |
||
54 | * @param string $path path to the file to be deleted |
||
55 | * |
||
56 | * @return void |
||
57 | * |
||
58 | * @throws \InvalidArgumentException if $path is whitespace |
||
59 | * @throws \Exception if unlink returns false |
||
60 | */ |
||
61 | public static function delete(string $path) |
||
81 | |||
82 | /** |
||
83 | * Recursively deletes the given directory path until a non-empty directory is found or the $stopAtPath is reached. |
||
84 | * |
||
85 | * @param string $deletePath The empty directory path to delete. |
||
86 | * @param string $stopAtPath The point at which the deletion should stop. Defaults to /. |
||
87 | * |
||
88 | * @return void |
||
89 | */ |
||
90 | public static function deletePathIfEmpty(string $deletePath, string $stopAtPath = '/') |
||
117 | } |
||
118 |