diff options
author | MaZderMind | 2016-12-10 18:22:34 +0100 |
---|---|---|
committer | MaZderMind | 2016-12-10 18:22:34 +0100 |
commit | f6c0270d40f6730fe1e1820f2866b08792df1db6 (patch) | |
tree | f0da1effc9f55f2f75dc57fe1ba17419d559b45b /model/ModelBase.php | |
parent | b227ac0ee80f6de300fed10a34e7393847227cfc (diff) |
rewrite data-model so that every configuration option is accessed through the conference
Diffstat (limited to '')
-rw-r--r-- | model/ModelBase.php | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/model/ModelBase.php b/model/ModelBase.php index 7b1370b..41f329b 100644 --- a/model/ModelBase.php +++ b/model/ModelBase.php @@ -2,14 +2,17 @@ class ModelBase { - protected function has($keychain) + protected $config; + public function __construct($config) { - return ModelBase::_has($GLOBALS['CONFIG'], $keychain); + $this->config = $config; } - protected static function staticHas($keychain) + + public function has($keychain) { - return ModelBase::_has($GLOBALS['CONFIG'], $keychain); + return ModelBase::_has($this->config, $keychain); } + private static function _has($array, $keychain) { if(!is_array($keychain)) @@ -25,14 +28,11 @@ class ModelBase return ModelBase::_has($array[$key], array_slice($keychain, 1)); } - protected function get($keychain, $default = null) + public function get($keychain, $default = null) { - return ModelBase::_get($GLOBALS['CONFIG'], $keychain, $default); - } - protected static function staticGet($keychain, $default = null) - { - return ModelBase::_get($GLOBALS['CONFIG'], $keychain, $default); + return ModelBase::_get($this->config, $keychain, $default); } + private static function _get($array, $keychain, $default) { if(!is_array($keychain)) |