示例#1
0
文件: Manager.php 项目: enzyme/axiom
 /**
  * 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);
 }
示例#2
0
文件: Config.php 项目: enzyme/axiom
 /**
  * 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.");
     }
 }