Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Lexer\FunctionLexer::lex PHP Method

lex() public method

public lex ( string $value ) : array
$value string
return array
    public function lex(string $value) : array
    {
        if (false === $this->functionTokenizer->isTokenized($value)) {
            $value = $this->functionTokenizer->tokenize($value);
        }
        return $this->decoratedLexer->lex($value);
    }

Usage Example

Example #1
0
 public function testIfTheValueHasAlreadyBeenTokenizedThenItWillNotBeTokenizedAgain()
 {
     $value = '<aliceTokenizedFunction(something)>';
     $decoratedLexerProphecy = $this->prophesize(LexerInterface::class);
     $decoratedLexerProphecy->lex($value)->willReturn($expected = [new Token('something', new TokenType(TokenType::FUNCTION_TYPE))]);
     /** @var LexerInterface $decoratedLexer */
     $decoratedLexer = $decoratedLexerProphecy->reveal();
     $lexer = new FunctionLexer($decoratedLexer);
     $actual = $lexer->lex($value);
     $this->assertEquals($expected, $actual);
     $decoratedLexerProphecy->lex(Argument::any())->shouldHaveBeenCalledTimes(1);
 }
FunctionLexer