Configuration class is now fully singleton
authorRoland Häder <roland@mxchange.org>
Fri, 3 Oct 2008 00:34:11 +0000 (00:34 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 3 Oct 2008 00:34:11 +0000 (00:34 +0000)
inc/classes/main/class_BaseFrameworkSystem.php
inc/config.php
inc/config/class_FrameworkConfiguration.php

index fe43a998f59c533aec830aef70c7d0f908f9bc22..38e689b1666c3969da6b5627ba959fcfd8557a09 100644 (file)
@@ -289,7 +289,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                        Registry::isInitialized('OK');
                } elseif ($this->__toString() == 'DebugMiddleware') {
                        // Set configuration instance
                        Registry::isInitialized('OK');
                } elseif ($this->__toString() == 'DebugMiddleware') {
                        // Set configuration instance
-                       $this->setConfigInstance(FrameworkConfiguration::createFrameworkConfiguration());
+                       $this->setConfigInstance(FrameworkConfiguration::getInstance());
                }
        }
 
                }
        }
 
index 65eba410628777f75095d58f48698c09617c8fdc..a9e58d7a0346e5fb1c3251749d94ba28be021e42 100644 (file)
@@ -30,7 +30,7 @@
 @require_once(dirname(__FILE__) . '/config/class_FrameworkConfiguration.php');
 
 // Get a new configuration instance
 @require_once(dirname(__FILE__) . '/config/class_FrameworkConfiguration.php');
 
 // Get a new configuration instance
-$cfg = FrameworkConfiguration::createFrameworkConfiguration();
+$cfg = FrameworkConfiguration::getInstance();
 
 // CFG: SERVER-PATH
 $cfg->setConfigEntry('base_path', (dirname(dirname(__FILE__)) . '/')); // DON'T MISS THE TRAILING SLASH!!!
 
 // CFG: SERVER-PATH
 $cfg->setConfigEntry('base_path', (dirname(dirname(__FILE__)) . '/')); // DON'T MISS THE TRAILING SLASH!!!
index e7dfb699c661148635d29fd4ad6e0b76d05c6532..2261c0f2a71d6a03629ca02e5d41c25b9c1cf55a 100644 (file)
@@ -51,46 +51,18 @@ class FrameworkConfiguration implements Registerable {
                // Empty for now
        }
 
                // Empty for now
        }
 
-       /**
-        * "Create" a configuration instance
-        *
-        * @param       $enableDebug    Wether enable debug mode (default: off)
-        * @return      $cfgInstance    An instance of this configuration class
-        */
-       public final static function createFrameworkConfiguration ($enableDebug = false) {
-               /**
-                * For singleton design pattern because we only need a one-time-run
-                * through the initial configuration.
-                */
-               if (is_null(self::$cfgInstance))  {
-                       // CFG: ERROR-REPORTING
-                       @error_reporting(E_ALL | E_STRICT);
-
-                       /**
-                        * Shall we enable the debug mode?
-                        */
-                       if ($enableDebug) {
-                               define('DEBUG_MODE', true);
-                       }
-
-                       /**
-                        * Crate a config instance
-                        */
-                       self::$cfgInstance = new FrameworkConfiguration();
-               }
-
-               /**
-                * Return the instance
-                */
-               return self::$cfgInstance;
-       }
-
        /**
         * Getter for an instance of this class
         *
         * @return      $cfgInstance    An instance of this class
         */
        public final static function getInstance () {
        /**
         * Getter for an instance of this class
         *
         * @return      $cfgInstance    An instance of this class
         */
        public final static function getInstance () {
+               // is the instance there?
+               if (is_null(self::$cfgInstance))  {
+                       // Create a config instance
+                       self::$cfgInstance = new FrameworkConfiguration();
+               } // END - if
+
                return self::$cfgInstance;
        }
 
                return self::$cfgInstance;
        }