public function getConfig($pageName, array $config)
 {
     if (!$this->has($pageName, $config)) {
         throw new PageNotFound($pageName);
     }
     try {
         $path = $this->path->calculate(array($config['directories']['config'], strtolower($pageName) . '.yml'));
     } catch (Exception $exp) {
         return $config['page_config'];
     }
     try {
         $pcfg = ConfigUtils::merge(Yaml::parse(file_get_contents($path)), $config['page_config']);
     } catch (\Exception $exp) {
         throw new InvalidConfigFile($path, null, $exp);
     }
     return $pcfg;
 }
Esempio n. 2
0
 /**
  * Parses and return the site.yml configuration file
  * 
  * @return array
  * @throws InvalidConfigFile
  */
 public function getSiteConfig()
 {
     if (isset($this->config)) {
         return $this->config;
     }
     try {
         $cfg = Yaml::parse(file_get_contents($this->configFile));
         $this->config = ConfigUtils::merge($cfg);
     } catch (\Exception $exp) {
         throw new InvalidConfigFile($this->configFile, null, $exp);
     }
     return $this->config;
 }