From e6fbb1972fba163170940ab454d749c0ea35b587 Mon Sep 17 00:00:00 2001
From: MaZderMind
Date: Mon, 30 Mar 2015 21:36:47 +0200
Subject: Allow static access

---
 model/ModelBase.php | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

(limited to 'model')

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);
 	}
 }
-- 
cgit v1.2.3