Nelmio\Alice\Parser\ParserRegistry::parse PHP Method

parse() public method

public parse ( string $file ) : array
$file string
return array
    public function parse(string $file) : array
    {
        foreach ($this->parsers as $parser) {
            if ($parser->canParse($file)) {
                return $parser->parse($file);
            }
        }
        throw ParseExceptionFactory::createForParserNoFoundForFile($file);
    }

Usage Example

Beispiel #1
0
 /**
  * @expectedException \Nelmio\Alice\Throwable\Exception\Parser\ParserNotFoundException
  * @expectedExceptionMessage No suitable parser found for the file "dummy.php".
  */
 public function testThrowsAnExceptionIfNoSuitableParserIsFound()
 {
     $registry = new ParserRegistry([]);
     $registry->parse('dummy.php');
 }
ParserRegistry