protected function checkPath($path)
{
if (count(glob($path . '/*')) !== 0) {
throw new RuntimeException('The folder is not empty: ' . realpath($path));
}
if (is_dir($path)) {
throw new RuntimeException('The folder exists and cannot be overwritten: ' . realpath($path));
}
}