diff options
author | MaZderMind | 2015-03-30 21:36:47 +0200 |
---|---|---|
committer | MaZderMind | 2015-03-30 21:36:47 +0200 |
commit | e6fbb1972fba163170940ab454d749c0ea35b587 (patch) | |
tree | 2e7cfa81d6609228c100dd420f5b14ac52eaa4dc /model/ModelBase.php | |
parent | 785e40eae22ab50c48cde894663fc6f70187bb2d (diff) |
Allow static access
Diffstat (limited to 'model/ModelBase.php')
-rw-r--r-- | model/ModelBase.php | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/model/ModelBase.php b/model/ModelBase.php index 1ee41b4..7b1370b 100644 --- a/model/ModelBase.php +++ b/model/ModelBase.php @@ -1,12 +1,16 @@ <?php -class Modelbase +class ModelBase { protected function has($keychain) { - return $this->_has($GLOBALS['CONFIG'], $keychain); + return ModelBase::_has($GLOBALS['CONFIG'], $keychain); } - private function _has($array, $keychain) + protected static function staticHas($keychain) + { + return ModelBase::_has($GLOBALS['CONFIG'], $keychain); + } + private static function _has($array, $keychain) { if(!is_array($keychain)) $keychain = explode('.', $keychain); @@ -18,14 +22,18 @@ class Modelbase if(count($keychain) == 1) return true; - return $this->_has($array[$key], array_slice($keychain, 1)); + return ModelBase::_has($array[$key], array_slice($keychain, 1)); } protected function get($keychain, $default = null) { - return $this->_get($GLOBALS['CONFIG'], $keychain, $default); + return ModelBase::_get($GLOBALS['CONFIG'], $keychain, $default); + } + protected static function staticGet($keychain, $default = null) + { + return ModelBase::_get($GLOBALS['CONFIG'], $keychain, $default); } - private function _get($array, $keychain, $default) + private static function _get($array, $keychain, $default) { if(!is_array($keychain)) $keychain = explode('.', $keychain); @@ -37,6 +45,6 @@ class Modelbase if(count($keychain) == 1) return $array[$key]; - return $this->_get($array[$key], array_slice($keychain, 1), $default); + return ModelBase::_get($array[$key], array_slice($keychain, 1), $default); } } |