Completed
Push — master ( 82eb41...4f6b0a )
by Alexander
03:49
created

ConstantSubLexer::getTokenAt()   B

Complexity

Conditions 5
Paths 5

Size

Total Lines 18
Code Lines 12

Duplication

Lines 10
Ratio 55.56 %

Code Coverage

Tests 12
CRAP Score 5

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 10
loc 18
ccs 12
cts 12
cp 1
rs 8.8571
cc 5
eloc 12
nc 5
nop 2
crap 5
1
<?php
2
namespace Xiag\Rql\Parser\SubLexer;
3
4
use Xiag\Rql\Parser\Token;
5
use Xiag\Rql\Parser\SubLexerInterface;
6
7
class ConstantSubLexer implements SubLexerInterface
8
{
9
    /**
10
     * @inheritdoc
11
     */
12 85
    public function getTokenAt($code, $cursor)
13
    {
14 85
        $test7 = substr($code, $cursor, 7);
15 85 View Code Duplication
        if ($test7 === 'empty()') {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16 8
            return new Token(Token::T_EMPTY, $test7, $cursor, $cursor + 7);
17 85
        } elseif ($test7 === 'false()') {
18 7
            return new Token(Token::T_FALSE, $test7, $cursor, $cursor + 7);
19
        }
20
21 85
        $test6 = substr($code, $cursor, 6);
22 85 View Code Duplication
        if ($test6 === 'null()') {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
23 10
            return new Token(Token::T_NULL, $test6, $cursor, $cursor + 6);
24 85
        } elseif ($test6 === 'true()') {
25 7
            return new Token(Token::T_TRUE, $test6, $cursor, $cursor + 6);
26
        }
27
28 85
        return null;
29
    }
30
}
31