]> git.mxchange.org Git - core.git/blobdiff - framework/config/class_FrameworkConfiguration.php
Rewrite:
[core.git] / framework / config / class_FrameworkConfiguration.php
index 82d50bf964606d4882a619806f11fa96178122fc..0826076e41a5f1b077ad3fbf62e41ac07a8cd46f 100644 (file)
@@ -48,12 +48,7 @@ class FrameworkConfiguration implements Registerable {
         * hard-coded configuration data and might be overwritten/extended by
         * config data from the database.
         */
         * hard-coded configuration data and might be overwritten/extended by
         * config data from the database.
         */
-       private $config = array();
-
-       /**
-        * The configuration instance itself
-        */
-       private static $configInstance = NULL;
+       private static $config = array();
 
        /**
         * Call-back instance (unused)
 
        /**
         * Call-back instance (unused)
@@ -66,11 +61,12 @@ class FrameworkConfiguration implements Registerable {
        const EXCEPTION_CONFIG_VALUE_TYPE_UNSUPPORTED = 0x132;
 
        /**
        const EXCEPTION_CONFIG_VALUE_TYPE_UNSUPPORTED = 0x132;
 
        /**
-        * Private constructor
+        * Default constructor, the configuration entries are static, not the
+        * whole instance.
         *
         * @return      void
         */
         *
         * @return      void
         */
-       private function __construct () {
+       public function __construct () {
                // Empty for now
        }
 
                // Empty for now
        }
 
@@ -83,22 +79,6 @@ class FrameworkConfiguration implements Registerable {
                return get_class($this);
        }
 
                return get_class($this);
        }
 
-       /**
-        * Getter for a singleton instance of this class
-        *
-        * @return      $configInstance         A singleton instance of this class
-        */
-       public static final function getSelfInstance () {
-               // is the instance there?
-               if (is_null(self::$configInstance)) {
-                       // Create a config instance
-                       self::$configInstance = new FrameworkConfiguration();
-               } // END - if
-
-               // Return singleton instance
-               return self::$configInstance;
-       }
-
        /**
         * Checks whether the given configuration key is set
         *
        /**
         * Checks whether the given configuration key is set
         *
@@ -121,7 +101,7 @@ class FrameworkConfiguration implements Registerable {
                }
 
                // Is it set?
                }
 
                // Is it set?
-               $isset = ((isset($this->config[$configKey])) || (array_key_exists($configKey, $this->config)));
+               $isset = ((isset(self::$config[$configKey])) || (array_key_exists($configKey, self::$config)));
 
                // Return the result
                return $isset;
 
                // Return the result
                return $isset;
@@ -159,7 +139,7 @@ class FrameworkConfiguration implements Registerable {
                } // END - if
 
                // Return the requested value
                } // END - if
 
                // Return the requested value
-               return $this->config[$configKey];
+               return self::$config[$configKey];
        }
 
        /**
        }
 
        /**
@@ -193,10 +173,10 @@ class FrameworkConfiguration implements Registerable {
 
                // Set the configuration value
                //* NOISY-DEBUG: */ print(__METHOD__ . ':configEntry=' . $configKey . ',configValue[' . gettype($configValue) . ']=' . $configValue . PHP_EOL);
 
                // Set the configuration value
                //* NOISY-DEBUG: */ print(__METHOD__ . ':configEntry=' . $configKey . ',configValue[' . gettype($configValue) . ']=' . $configValue . PHP_EOL);
-               $this->config[$configKey] = $configValue;
+               self::$config[$configKey] = $configValue;
 
                // Resort the array
 
                // Resort the array
-               ksort($this->config);
+               ksort(self::$config);
        }
 
        /**
        }
 
        /**
@@ -206,7 +186,7 @@ class FrameworkConfiguration implements Registerable {
         */
        public final function getConfigurationArray () {
                // Return it
         */
        public final function getConfigurationArray () {
                // Return it
-               return $this->config;
+               return self::$config;
        }
 
        /**
        }
 
        /**
@@ -242,7 +222,7 @@ class FrameworkConfiguration implements Registerable {
                } // END - if
 
                // Unset it
                } // END - if
 
                // Unset it
-               unset($this->config[$configKey]);
+               unset(self::$config[$configKey]);
        }
 
        /**
        }
 
        /**