Nelmio\Alice\Throwable\Exception\Parser\ParseExceptionFactory::createForParserNoFoundForFile PHP Method

createForParserNoFoundForFile() public static method

public static createForParserNoFoundForFile ( string $file ) : ParserNotFoundException
$file string
return ParserNotFoundException
    public static function createForParserNoFoundForFile(string $file) : ParserNotFoundException
    {
        return new ParserNotFoundException(sprintf('No suitable parser found for the file "%s".', $file));
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Looks for the first suitable parser to parse the file.
  *
  * {@inheritdoc}
  */
 public function parse(string $file) : array
 {
     foreach ($this->parsers as $parser) {
         if ($parser->canParse($file)) {
             return $parser->parse($file);
         }
     }
     throw ParseExceptionFactory::createForParserNoFoundForFile($file);
 }