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

lex() public method

public lex ( string $value ) : array
$value string
return array
    public function lex(string $value) : array
    {
        if ('' === $value) {
            return [new Token('', new TokenType(TokenType::STRING_TYPE))];
        }
        return $this->lexer->lex($value);
    }

Usage Example

Example #1
0
 public function testHandOverTheLexificationToItsDecoratedLexerIfStringIsNotEmpty()
 {
     $value = 'bob';
     $decoratedLexerProphecy = $this->prophesize(LexerInterface::class);
     $decoratedLexerProphecy->lex($value)->willReturn($expected = [new \stdClass()]);
     /** @var LexerInterface $decoratedLexer */
     $decoratedLexer = $decoratedLexerProphecy->reveal();
     $lexer = new EmptyValueLexer($decoratedLexer);
     $actual = $lexer->lex($value);
     $this->assertEquals(count($expected), count($actual));
     $this->assertEquals($expected, $actual);
     $decoratedLexerProphecy->lex(Argument::any())->shouldHaveBeenCalledTimes(1);
 }
EmptyValueLexer