This commit is contained in:
Florian Bouillon 2019-03-07 12:56:11 +01:00
parent 194ca52738
commit d8fa7d01bf

View File

@ -75,9 +75,7 @@ class Functions {
} }
public static function deleteDir($dirPath) { public static function deleteDir($dirPath) {
if (! is_dir($dirPath)) { if (is_dir($dirPath)) {
throw new InvalidArgumentException("$dirPath must be a directory");
}
if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') { if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
$dirPath .= '/'; $dirPath .= '/';
} }
@ -91,4 +89,5 @@ class Functions {
} }
rmdir($dirPath); rmdir($dirPath);
} }
}
} }