]> git.mxchange.org Git - core.git/blobdiff - framework/config/class_FrameworkConfiguration.php
Continued:
[core.git] / framework / config / class_FrameworkConfiguration.php
index 82d50bf964606d4882a619806f11fa96178122fc..be9d7d6dc137c73a39f464a1d14873efc3f638b8 100644 (file)
@@ -1,16 +1,14 @@
 <?php
 
 // Own namespace
-namespace CoreFramework\Configuration;
+namespace Org\Mxchange\CoreFramework\Configuration;
 
 // Import framework stuff
-use CoreFramework\Console\Tools\ConsoleTools;
-use CoreFramework\Dns\UnknownHostnameException;
-use CoreFramework\Generic\FrameworkInterface;
-use CoreFramework\Generic\NullPointerException;
-use CoreFramework\Generic\UnsupportedOperationException;
-use CoreFramework\Object\BaseFrameworkSystem;
-use CoreFramework\Registry\Registerable;
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
+use Org\Mxchange\CoreFramework\Generic\NullPointerException;
+use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
+use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Registry\Registerable;
 
 // Import SPL stuff
 use \InvalidArgumentException;
@@ -48,12 +46,7 @@ class FrameworkConfiguration implements Registerable {
         * 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)
@@ -66,11 +59,12 @@ class FrameworkConfiguration implements Registerable {
        const EXCEPTION_CONFIG_VALUE_TYPE_UNSUPPORTED = 0x132;
 
        /**
-        * Private constructor
+        * Default constructor, the configuration entries are static, not the
+        * whole instance.
         *
         * @return      void
         */
-       private function __construct () {
+       public function __construct () {
                // Empty for now
        }
 
@@ -83,22 +77,6 @@ class FrameworkConfiguration implements Registerable {
                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
         *
@@ -121,7 +99,7 @@ class FrameworkConfiguration implements Registerable {
                }
 
                // 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;
@@ -159,7 +137,7 @@ class FrameworkConfiguration implements Registerable {
                } // END - if
 
                // Return the requested value
-               return $this->config[$configKey];
+               return self::$config[$configKey];
        }
 
        /**
@@ -193,10 +171,10 @@ class FrameworkConfiguration implements Registerable {
 
                // 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
-               ksort($this->config);
+               ksort(self::$config);
        }
 
        /**
@@ -206,7 +184,7 @@ class FrameworkConfiguration implements Registerable {
         */
        public final function getConfigurationArray () {
                // Return it
-               return $this->config;
+               return self::$config;
        }
 
        /**
@@ -242,7 +220,7 @@ class FrameworkConfiguration implements Registerable {
                } // END - if
 
                // Unset it
-               unset($this->config[$configKey]);
+               unset(self::$config[$configKey]);
        }
 
        /**