diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-10-08 09:24:28 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-10-08 09:24:28 +0400 |
commit | 1fa8da9b963e99e08c829fe6491e8ccf2d1054e2 (patch) | |
tree | 137c50850a5f21f1651f8066d4bd381a661e1987 /core/Registry.php | |
parent | fcbef99dbf93df94ff5ed4cfaa5eeebfcf4aac14 (diff) |
Applying phpstorm code style PSR refs #3771
Diffstat (limited to 'core/Registry.php')
-rw-r--r-- | core/Registry.php | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/core/Registry.php b/core/Registry.php index 8081989b7c..5fe90370b9 100644 --- a/core/Registry.php +++ b/core/Registry.php @@ -20,45 +20,54 @@ class Registry private static $instance; private $data; - private function __construct() { + private function __construct() + { $this->data = array(); } - public static function getInstance() { - if(self::$instance == null) { + public static function getInstance() + { + if (self::$instance == null) { self::$instance = new Registry(); } return self::$instance; } - public static function isRegistered($key) { + public static function isRegistered($key) + { return self::getInstance()->hasKey($key); } - public static function get($key) { + public static function get($key) + { return self::getInstance()->getKey($key); } - public static function set($key, $value) { + public static function set($key, $value) + { self::getInstance()->setKey($key, $value); } - public static function unsetInstance() { + public static function unsetInstance() + { self::$instance = null; } - public function setKey($key, $value) { + public function setKey($key, $value) + { $this->data[$key] = $value; } - public function getKey($key) { - if(!$this->hasKey($key)) { + public function getKey($key) + { + if (!$this->hasKey($key)) { throw new \Exception(sprintf("Key '%s' doesn't exist in Registry", $key)); } return $this->data[$key]; } - public function hasKey($key) { + public function hasKey($key) + { return array_key_exists($key, $this->data); } } |