X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FConfig%2FConfigCache.php;h=e03d3525666464a849e5c09e53f4179b3abdfb05;hb=a0b14a46cb83b93ea5f42437bc78aafd20eec70c;hp=b50ba3e00450eaf40bf8d177d1164960325ac8d3;hpb=f3da5b3a2f98883e4a06c345dfe2880394f7d21d;p=friendica.git diff --git a/src/Core/Config/ConfigCache.php b/src/Core/Config/ConfigCache.php index b50ba3e004..e03d352566 100644 --- a/src/Core/Config/ConfigCache.php +++ b/src/Core/Config/ConfigCache.php @@ -2,23 +2,23 @@ namespace Friendica\Core\Config; +/** + * The Friendica config cache for the application + * Initial, all *.config.php files are loaded into this cache with the + * ConfigCacheLoader ( @see ConfigCacheLoader ) + * + * Is used for further caching operations too (depending on the ConfigAdapter ) + */ class ConfigCache implements IConfigCache, IPConfigCache { + private $config; + /** - * 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 + * @param array $config A initial config array */ - public $config; - - public function __construct($config = [], $overwrite = false) + public function __construct(array $config = []) { - $this->config = []; - - if (isset($config)) { - $this->loadConfigArray($config, $overwrite); - } + $this->config = $config; } /** @@ -33,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); } } } @@ -73,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); } }