/** * * @param \n2n\core\config\AppConfig * @throws \n2n\util\config\InvalidConfigurationException */ private function initConfiguration(N2nCache $n2nCache) { $cacheStore = $n2nCache->getStartupCacheStore(); $hashCode = null; if ($cacheStore === null || null === ($hashCode = $this->combinedConfigSource->hashCode())) { $appConfigFactory = new AppConfigFactory($this->publicDirPath); $this->appConfig = $appConfigFactory->create($this->combinedConfigSource, N2N::getStage()); $this->applyConfiguration($n2nCache); return; } $characteristics = array('version' => N2N::VERSION, 'stage' => N2N::getStage(), 'hashCode' => $hashCode, 'publicDir' => (string) $this->publicDirPath); if (null !== ($cacheItem = $cacheStore->get(self::CONFIG_CACHE_NAME, $characteristics))) { $this->appConfig = $cacheItem->getData(); if ($this->appConfig instanceof AppConfig) { $this->applyConfiguration($n2nCache); return; } $this->appConfig = null; } $appConfigFactory = new AppConfigFactory($this->publicDirPath); $this->appConfig = $appConfigFactory->create($this->combinedConfigSource, N2N::getStage()); $this->applyConfiguration($n2nCache); $cacheStore->removeAll(self::CONFIG_CACHE_NAME); $cacheStore->store(self::CONFIG_CACHE_NAME, $characteristics, $this->appConfig); }