*/
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;
}
/**
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);
}
}
}
private function setDefault($cat, $k, $v)
{
if (!isset($this->config[$cat][$k])) {
- self::set($cat, $k, $v);
+ $this->set($cat, $k, $v);
}
}