public function testCheckIfFileIsDirectoryWorksOnFile() { $path = __DIR__ . '/dummy/dummy.jpg'; $this->assertFalse(File::isDirectory($path), "{$path} is a folder"); }
/** * creates folder recursively if there's none * must have a prefix, by default /public. * * @param string $path Path to be created */ public function directorize($path) { $folders = explode('/', $path); $pathbuild = $this->prefix; foreach ($folders as $folder) { $pathbuild .= "{$folder}/"; $cond = File::exists($pathbuild) && File::isDirectory($pathbuild); if (!$cond) { File::makeDirectory($pathbuild); File::put("{$pathbuild}.gitkeep", 'Generated by `anekdotes/manager`'); } } }