diff --git a/api/cora/setting.example.php b/api/cora/setting.example.php index bc5b2e5..9187243 100644 --- a/api/cora/setting.example.php +++ b/api/cora/setting.example.php @@ -202,17 +202,20 @@ final class setting { */ public function get($setting) { if(array_key_exists($setting, $this->settings) === true) { - if(array_key_exists($this->settings['environment'], $this->settings[$setting]) === true) { - return $this->settings[$setting][$this->settings['environment']]; - } - else { + if(is_array($this->settings[$setting]) === true) { + if(array_key_exists($this->settings['environment'], $this->settings[$setting]) === true) { + return $this->settings[$setting][$this->settings['environment']]; + } else { + throw new \Exception('Setting does not exist for environment.'); + } + } else { return $this->settings[$setting]; } - } - else { + } else { throw new \Exception('Setting does not exist.', 1300); } } + } /** * Whether or not the current configuration is running the demo.