added code generator back to repository

This commit is contained in:
omair saleh
2020-09-14 16:36:40 +08:00
parent 0cab8e6456
commit 06b024ce9f
84 changed files with 5955 additions and 1 deletions
@@ -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;
}
}