Beispiel #1
0
 /**
  * Gets a parser for a given file extension
  *
  * @param   string  $extension
  * @return  object
  * @throws  UnsupportedFormatException  If `$extension` is an unsupported file format
  */
 protected function getParser($extension)
 {
     $parser = null;
     $extension = strtolower($extension);
     foreach (Processor::all() as $fileParser) {
         if (in_array($extension, $fileParser->getSupportedExtensions())) {
             $parser = $fileParser;
             break;
         }
     }
     // If none exist, then throw an exception
     if ($parser === null) {
         throw new UnsupportedFormatException(sprintf('Unsupported configuration format "%s"', $extension));
     }
     return $parser;
 }
Beispiel #2
0
 /**
  * Get the list of all available processors
  *
  * @return  array
  */
 public function processors()
 {
     return Processor::all();
 }