Jarves\Jarves::loadBundleConfigs PHP Method

loadBundleConfigs() public method

Loads all configurations from all registered bundles (BundleName/Resources/config/jarves*.xml)
public loadBundleConfigs ( Cacher $cacher ) : null | callable
$cacher Jarves\Cache\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);
            };
        }
    }