mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 01:25:27 +00:00
init config model
This commit is contained in:
parent
cba3676d73
commit
789db97319
6 changed files with 247 additions and 230 deletions
|
|
@ -6,30 +6,6 @@ namespace Yggverse\Yoda\Model;
|
|||
|
||||
class File
|
||||
{
|
||||
public static function getConfig(): object
|
||||
{
|
||||
$filename = __DIR__ .
|
||||
DIRECTORY_SEPARATOR . '..' .
|
||||
DIRECTORY_SEPARATOR . '..' .
|
||||
DIRECTORY_SEPARATOR . 'config.json';
|
||||
|
||||
if (file_exists($filename) && is_readable($filename))
|
||||
{
|
||||
$result = json_decode(
|
||||
file_get_contents(
|
||||
$filename
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($result))
|
||||
{
|
||||
throw new \Exception(); // @TODO
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function getTheme(string $name): string
|
||||
{
|
||||
$filename = __DIR__ .
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue