/** * 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."); } }
/** * 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); }