Файл: MobileCMS-2.7.0-beta/System/Kernel/Config/ConfigLoader.php
Строк: 43
<?php
/**
* MobileCMS
*
* Open source content management system for mobile sites
*
* @author KpuTuK <bykputuk@ya.ru>
* @copyright Copyright (c) 2015, MobileCMS Team
* @license MIT License
*/
namespace SystemKernelConfig;
/**
* Загрузчик настроек
* @author KpuTuK <bykputuk@ya.ru>
* @author Fabien Potencier <fabien@symfony.com>
* @version 1.0.0
* @package MobileCMS
* @category Configuration component
*/
class ConfigLoader {
/**
* @var array
*/
protected $paths;
public function __construct(array $paths = []) {
$this->paths = $paths;
}
public function addPath($path) {
$this->paths[] = $path;
}
public function load($config) {
$method = 'get'.$config;
if ( ! file_exists(APPS .'Cache/ClassCache/ConfigCache.php')) {
(new ConfigDumper($this->paths))->dumpConfig($config, []);
}
$cache = new ApplicationCacheClassCacheConfigCache();
if ( ! method_exists($cache, $method)) {
(new ConfigDumper($this->paths))->dumpConfig($config, $cache->getNames());
}
return $cache->$method();
}
}