]> git.mxchange.org Git - core.git/commitdiff
Refactured 'BaseRegistry::getInstance()' a little
authorRoland Häder <roland@mxchange.org>
Mon, 14 May 2012 20:18:23 +0000 (20:18 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 14 May 2012 20:18:23 +0000 (20:18 +0000)
inc/classes/main/registry/class_BaseRegistry.php

index 84b6d63ba7a7971ecd8a6487d00f8c35f6852a6b..73c60cf34c2044015687beb307498c1cbb9e0af9 100644 (file)
@@ -168,20 +168,15 @@ class BaseRegistry extends BaseFrameworkSystem implements Registerable {
         * @throws      NullPointerException    If the requested key is not found
         */
        public function getInstance ($instanceKey) {
-               // By default the instance is not in registry
-               $objectInstance = NULL;
-
                // Is the instance there?
-               if ($this->instanceExists($instanceKey)) {
-                       $objectInstance = $this->instanceRegistry[$instanceKey];
-               } // END - if
-
-               // Still not fetched?
-               if (is_null($objectInstance)) {
+               if (!$this->instanceExists($instanceKey)) {
                        // This might happen if a non-registered key was requested
                        throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
                } // END - if
 
+               // Get the instance
+               $objectInstance = $this->instanceRegistry[$instanceKey];
+
                // Return the result
                return $objectInstance;
        }