mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-19 04:23:59 +00:00
added code generator back to repository
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\CodeGenerator\Utils;
|
||||
|
||||
class FileUtil
|
||||
{
|
||||
public static function createFile($path, $fileName, $contents)
|
||||
{
|
||||
if (!file_exists($path)) {
|
||||
mkdir($path, 0755, true);
|
||||
}
|
||||
|
||||
$path = $path.$fileName;
|
||||
|
||||
file_put_contents($path, $contents);
|
||||
}
|
||||
|
||||
public static function createDirectoryIfNotExist($path, $replace = false)
|
||||
{
|
||||
if (file_exists($path) && $replace) {
|
||||
rmdir($path);
|
||||
}
|
||||
|
||||
if (!file_exists($path)) {
|
||||
mkdir($path, 0755, true);
|
||||
}
|
||||
}
|
||||
|
||||
public static function deleteFile($path, $fileName)
|
||||
{
|
||||
if (file_exists($path.$fileName)) {
|
||||
return unlink($path.$fileName);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user