]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Config/ConfigCache.php
Merge pull request #6581 from nupplaphil/config_refact
[friendica.git] / src / Core / Config / ConfigCache.php
index 355b1df2f5c3d3b56d7b67acd7d4222379d13c03..e03d3525666464a849e5c09e53f4179b3abdfb05 100644 (file)
@@ -11,24 +11,14 @@ namespace Friendica\Core\Config;
  */
 class ConfigCache implements IConfigCache, IPConfigCache
 {
-       /**
-        * NEVER, EVER use this public config array outside of the class
-        * It is only public due to backward compatibility to .htconfig.php
-        *
-        * @var array The cached config array
-        */
-       public $config;
+       private $config;
 
        /**
         * @param array $config    A initial config array
         */
-       public function __construct($config = [])
+       public function __construct(array $config = [])
        {
-               $this->config = [];
-
-               if (isset($config)) {
-                       $this->loadConfigArray($config, true);
-               }
+               $this->config = $config;
        }
 
        /**
@@ -43,9 +33,9 @@ class ConfigCache implements IConfigCache, IPConfigCache
                foreach ($config as $category => $values) {
                        foreach ($values as $key => $value) {
                                if ($overwrite) {
-                                       self::set($category, $key, $value);
+                                       $this->set($category, $key, $value);
                                } else {
-                                       self::setDefault($category, $key, $value);
+                                       $this->setDefault($category, $key, $value);
                                }
                        }
                }
@@ -83,7 +73,7 @@ class ConfigCache implements IConfigCache, IPConfigCache
        private function setDefault($cat, $k, $v)
        {
                if (!isset($this->config[$cat][$k])) {
-                       self::set($cat, $k, $v);
+                       $this->set($cat, $k, $v);
                }
        }