Lexer   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 4
c 3
b 1
f 0
lcom 0
cbo 1
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getNextToken() 0 18 4
1
<?php
2
3
namespace PhpSchool\PSX;
4
5
use PhpParser\Lexer\Emulative;
6
use PhpParser\Parser\Tokens;
7
8
/**
9
 * Class Lexer
10
 * @package PhpSchool\PSX
11
 * @author Aydin Hassan <[email protected]>
12
 */
13
class Lexer extends Emulative
14
{
15
    public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null)
16
    {
17
        $tokenId = parent::getNextToken($value, $startAttributes, $endAttributes);
18
19
        if ($tokenId == Tokens::T_ARRAY) {
20
            $startAttributes['traditionalArray'] = true;
21
        }
22
23
        if ($tokenId == Tokens::T_EXIT) {
24
            $startAttributes['isDie'] = strtolower($value) === 'die';
25
        }
26
27
        if ($tokenId == Tokens::T_CONSTANT_ENCAPSED_STRING) {
28
            $endAttributes['originalValue'] = $value;
29
        }
30
        
31
        return $tokenId;
32
    }
33
}
34