This repository has been archived on 2023-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
web/app/lib/App/Core/Config.php

25 lines
467 B
PHP
Raw Permalink Normal View History

2022-01-24 07:38:51 +00:00
<?php
2022-03-02 06:15:12 +00:00
namespace App\Core;
2022-04-13 19:22:21 +00:00
use \InvalidArgumentException;
2022-03-02 06:15:12 +00:00
/**
2022-04-13 19:22:21 +00:00
* TODO: this should validate the config and stuffs
2022-03-02 06:15:12 +00:00
*/
2022-01-24 07:38:51 +00:00
class Config
{
2022-03-02 06:15:12 +00:00
/**
* Should hold the validated config array
*/
2022-01-24 07:38:51 +00:00
public array $config;
public function __construct(string $path)
{
2022-01-24 11:55:37 +00:00
if (!file_exists($path))
{
2022-04-13 19:22:21 +00:00
throw new InvalidArgumentException("Could not find configuration file: $path");
2022-01-24 07:38:51 +00:00
}
$this->config = require $path;
}
}