Some more comments added, selfInstance rewritten to registryInstance
authorRoland Häder <roland@mxchange.org>
Wed, 11 Mar 2009 02:37:22 +0000 (02:37 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 11 Mar 2009 02:37:22 +0000 (02:37 +0000)
inc/classes/main/registry/class_Registry.php

index 625e797..243c2b4 100644 (file)
@@ -25,7 +25,7 @@ class Registry extends BaseFrameworkSystem implements Register {
        /**
         * Instance of this class
         */
-       private static $selfInstance = null;
+       private static $registryInstance = null;
 
        /**
         * Wether the registry is initialized
@@ -52,32 +52,37 @@ class Registry extends BaseFrameworkSystem implements Register {
        }
 
        /**
-        * Singleton getter for self instance
+        * Singleton getter for self instance. This class has no factory pattern
+        * because here is no need for special parameters.
         *
-        * @return      $selfInstance   Instance of this class
+        * @return      $registryInstance       Instance of this class
         */
        public final static function getRegistry () {
                // Is an instance there?
-               if (is_null(self::$selfInstance)) {
+               if (is_null(self::$registryInstance)) {
                        // Not yet, so create one
-                       self::$selfInstance = new Registry();
+                       self::$registryInstance = new Registry();
                }
 
                // Return the instance
-               return self::$selfInstance;
+               return self::$registryInstance;
        }
 
        /**
-        * Checks or sets wether the registry has been initialized. This had only be done once
+        * Checks or sets wether the registry has been initialized. This had only
+        * be done once.
         *
         * @param       $initialized    Wether the registry is initialized
         * @return      $initialized    Wether the registry is initialized
         */
        public final static function isInitialized ($initialized = null) {
+               // If no parameter (null by default) is provided we want to get the
+               // parameter. If set to e.g. "OK" then the registry is set to
+               // "initialized".
                if (is_null($initialized)) {
                        // Get status if initialized
                        return self::$initialized;
-               } elseif (!is_null($initialized)) {
+               } else {
                        // Registry is initialized!
                        self::$initialized = true;
                }