예제 #1
0
 public function produce()
 {
     $template = new Template($this->template);
     foreach ($this->settings as $key => $value) {
         $template->place($key, $value);
     }
     return $template->produce();
 }
예제 #2
0
 /**
  * Loads configuration from Yaml data
  *
  * @param string $contents Yaml config file contents
  * @return array
  */
 protected static function getConfFromContents($contents)
 {
     if (self::$params) {
         $template = new Template($contents, '%', '%');
         $template->setVars(self::$params);
         $contents = $template->produce();
     }
     return Yaml::parse($contents);
 }
 /**
  * Loads configuration from Yaml file or returns given value if the file doesn't exist
  *
  * @param string $filename filename
  * @param mixed $nonExistentValue value used if filename is not found
  * @return array
  */
 protected static function getConfFromFile($filename, $nonExistentValue = [])
 {
     if (file_exists($filename)) {
         $yaml = file_get_contents($filename);
         if (self::$params) {
             $template = new Template($yaml, '%', '%');
             $template->setVars(self::$params);
             $yaml = $template->produce();
         }
         return Yaml::parse($yaml);
     }
     return $nonExistentValue;
 }