public parse ( |
||
$token |
public function parse(Token $token)
{
foreach ($this->parsers as $parser) {
if ($parser->canParse($token)) {
return $parser->parse($token);
}
}
throw ExpressionLanguageExceptionFactory::createForNoParserFoundForToken($token);
}
/** * @expectedException \Nelmio\Alice\Throwable\Exception\FixtureBuilder\ExpressionLanguage\ParserNotFoundException * @expectedExceptionMessage No suitable token parser found to handle the token "foo" (type: STRING_TYPE). */ public function testThrowsAnExceptionIfNoSuitableParserIsFound() { $registry = new TokenParserRegistry([]); $registry->parse(new Token('foo', new TokenType(TokenType::STRING_TYPE))); }