Initial import
This commit is contained in:
21
lib/Config.php
Executable file
21
lib/Config.php
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
class Config {
|
||||
private static $config = null;
|
||||
|
||||
private function __construct() {
|
||||
}
|
||||
|
||||
public static function get(string $val, mixed $default = null) : mixed {
|
||||
if (Config::$config == null) {
|
||||
Config::$config = parse_ini_file(__DIR__ . "/../.env");
|
||||
}
|
||||
if (array_key_exists($val, Config::$config)) {
|
||||
return Config::$config[$val];
|
||||
} else {
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user