1
0
mirror of https://github.com/beestat/app.git synced 2025-06-23 15:30:43 -04:00

Made setting->get() a bit clearer.

This commit is contained in:
Jon Ziebell 2019-07-06 14:28:13 -04:00
parent fd724fd3db
commit 2773fd7184

View File

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