setCore() public method

public setCore ( Jarves $core )
$core Jarves\Jarves
コード例 #1
0
ファイル: Jarves.php プロジェクト: jarves/jarves
 /**
  * Loads all configurations from all registered bundles (BundleName/Resources/config/jarves*.xml)
  * @param Cacher $cacher
  *
  * @return null|callable returns a callable that should be called when config stuff have been registered
  */
 public function loadBundleConfigs(Cacher $cacher)
 {
     $cached = $cacher->getFastCache('core/configs');
     $bundles = array_keys($this->kernel->getBundles());
     $configs = new Configuration\Configs($this);
     $hashes = [];
     foreach ($bundles as $bundleName) {
         $hashes[] = $configs->getConfigHash($bundleName);
     }
     $hash = md5(implode('.', $hashes));
     if ($cached) {
         $cached = unserialize($cached);
         if (is_array($cached) && $cached['md5'] == $hash) {
             $this->configs = $cached['data'];
             $this->configs->setCore($this);
         }
     }
     if (!$this->configs) {
         $this->configs = new Configuration\Configs($this, $bundles);
         return function () use($hash, $cacher) {
             $cached = serialize(['md5' => $hash, 'data' => $this->configs]);
             $cacher->setFastCache('core/configs', $cached);
         };
     }
 }