InfyOm\Generator\Utils\FileUtil::createDirectoryIfNotExist PHP Метод

createDirectoryIfNotExist() публичный статический Метод

public static createDirectoryIfNotExist ( $path, $replace = false )
    public static function createDirectoryIfNotExist($path, $replace = false)
    {
        if (file_exists($path) && $replace) {
            rmdir($path);
        }
        if (!file_exists($path)) {
            mkdir($path, 0755, true);
        }
    }

Usage Example

 private function createDirectories($viewsPath)
 {
     FileUtil::createDirectoryIfNotExist($viewsPath . 'layouts');
     FileUtil::createDirectoryIfNotExist($viewsPath . 'auth');
     if ($this->laravelVersion == '5.1') {
         FileUtil::createDirectoryIfNotExist($viewsPath . 'emails');
     } else {
         FileUtil::createDirectoryIfNotExist($viewsPath . 'auth/passwords');
         FileUtil::createDirectoryIfNotExist($viewsPath . 'auth/emails');
     }
 }
All Usage Examples Of InfyOm\Generator\Utils\FileUtil::createDirectoryIfNotExist