Ejemplo n.º 1
0
 /**
  * Parse the given YAML file.
  *
  * @param string $file The path to the file.
  *
  * @throws Exception If the YAML file cannot be parsed.
  */
 public function parse($file)
 {
     if (false === $this->file_dispatch->exists($file)) {
         return;
     }
     try {
         $results = $this->parser->parse($this->file_dispatch->getContents($file));
         if (true === is_array($results)) {
             $this->config = $results;
         }
     } catch (ParseException $e) {
         throw new Exception("The yaml configuration file [{$file}] is invalid.");
     }
 }
Ejemplo n.º 2
0
 /**
  * Write the given contents out to the specified file.
  *
  * @param string $contents
  * @param string $path
  */
 public function writeOut($contents, $path)
 {
     $this->file_dispatch->putContents($path, $contents);
 }