Code Duplication    Length = 19-19 lines in 2 locations

src/SubLexer/RqlOperatorSubLexer.php 1 location

@@ 7-25 (lines=19) @@
4
use Xiag\Rql\Parser\Token;
5
use Xiag\Rql\Parser\SubLexerInterface;
6
7
class RqlOperatorSubLexer implements SubLexerInterface
8
{
9
    /**
10
     * @inheritdoc
11
     */
12
    public function getTokenAt($code, $cursor)
13
    {
14
        if (!preg_match('/[a-z]\w*(?=\()/Ai', $code, $matches, null, $cursor)) {
15
            return null;
16
        }
17
18
        return new Token(
19
            Token::T_OPERATOR,
20
            $matches[0],
21
            $cursor,
22
            $cursor + strlen($matches[0])
23
        );
24
    }
25
}
26

src/SubLexer/TypeSubLexer.php 1 location

@@ 7-25 (lines=19) @@
4
use Xiag\Rql\Parser\Token;
5
use Xiag\Rql\Parser\SubLexerInterface;
6
7
class TypeSubLexer implements SubLexerInterface
8
{
9
    /**
10
     * @inheritdoc
11
     */
12
    public function getTokenAt($code, $cursor)
13
    {
14
        if (!preg_match('/[a-z]\w*(?=:)/Ai', $code, $matches, null, $cursor)) {
15
            return null;
16
        }
17
18
        return new Token(
19
            Token::T_TYPE,
20
            $matches[0],
21
            $cursor,
22
            $cursor + strlen($matches[0])
23
        );
24
    }
25
}
26