Exemplo n.º 1
0
 /**
  * Get the contents for the provided stub.
  *
  * @param string $stub
  *
  * @return string
  *
  * @throws InvalidArgumentException If the stub by the given name does not
  * exist in the `console/Stubs` folder using the format `{name}.stub`.
  */
 public function get($stub)
 {
     $file = $this->stubs_dir . $stub . '.stub';
     if (false === $this->file_dispatch->exists($file)) {
         throw new InvalidArgumentException("The stub [{$stub}] does not exist");
     }
     return $this->file_dispatch->getContents($file);
 }
Exemplo n.º 2
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.");
     }
 }