allow better standard config

This commit is contained in:
Guillermo Dev
2018-10-08 23:56:17 +02:00
parent 34acb97743
commit 84c310e8d9
3 changed files with 54 additions and 10 deletions

View File

@@ -60,16 +60,17 @@ class Configuration {
// by default, set the session save path to the default value;
$this->values['session']['save_path'] = session_save_path();
if(file_exists($this->custom_config)) {
/** @noinspection PhpIncludeInspection */
require_once($this->custom_config);
if(! isset($configuration) || ! is_array($configuration)) {
throw new \RuntimeException("You custom configuration in '{$this->custom_config}' must be in a variable named '\$configuration' and be an array.");
}
$this->values = array_replace_recursive($this->values, $configuration);
if(!file_exists($this->custom_config)) {
throw new \Exception\UsageException('No configuration.local.php file was found. Create it with the proper config.');
}
$configuration = include_once $this->custom_config;
if(!is_array($configuration)) {
throw new \RuntimeException("You custom configuration in '{$this->custom_config}' must be in a variable named '\$configuration' and be an array.");
}
$this->values = array_replace_recursive($this->values, $configuration);
}
private function dotNotationAccess($data, $key, $default=null)