Cleanup
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use Exception;
|
||||
|
||||
class Config
|
||||
{
|
||||
private static array $instances = [];
|
||||
|
||||
private array $app;
|
||||
private array $database;
|
||||
|
||||
protected function __construct()
|
||||
{
|
||||
$this->app = require_once __DIR__ . "/app.php";
|
||||
$this->database = require_once __DIR__ . "/database.php";
|
||||
}
|
||||
|
||||
protected function __clone()
|
||||
{
|
||||
}
|
||||
|
||||
public function __wakeup()
|
||||
{
|
||||
throw new Exception("Cannot unserialize a singleton.");
|
||||
}
|
||||
|
||||
private static function getInstance(): Config
|
||||
{
|
||||
$cls = static::class;
|
||||
if (!isset(self::$instances[$cls])) {
|
||||
self::$instances[$cls] = new static();
|
||||
}
|
||||
|
||||
return self::$instances[$cls];
|
||||
}
|
||||
|
||||
public static function getBasePath(): string
|
||||
{
|
||||
return Config::getInstance()->app["basePath"];
|
||||
}
|
||||
|
||||
public static function getBaseFSPath(): string
|
||||
{
|
||||
return Config::getInstance()->app["baseFSPath"];
|
||||
}
|
||||
|
||||
public static function getStoragePath(): string
|
||||
{
|
||||
return Config::getInstance()->app["storagePath"];
|
||||
}
|
||||
|
||||
public static function getDatabase(): array
|
||||
{
|
||||
return Config::getInstance()->database;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user