Пример #1
0
 /**
  * Loads the config instance.
  *
  * @param bool $refresh - Load again even if it was already loaded?
  *
  * @return void
  */
 public function initializeConfig($refresh = false)
 {
     if (!$this->_configurationWasInitialized || $refresh) {
         $cache = $this->getKernelCache($refresh);
         $this->_config = new Config([], ['templateVariables' => $this->getOption('configTemplateVariables', [])]);
         if (!($config = $cache->fetch(self::KERNEL_CACHE_CONFIG_ID))) {
             $this->loadComponentsConfigFiles();
             $this->loadRootProjectConfigFiles();
             $this->runOnComponentConfigRegistrationProcessorMethod();
             $this->runOnBeforeCacheMethod();
             $cache->save(self::KERNEL_CACHE_CONFIG_ID, $this->_config->getData());
         } else {
             $this->_config->setData($config);
         }
         $this->runOnAfterCacheMethod();
         $this->_configurationWasInitialized = true;
     }
 }