Completed
Pull Request — master (#41)
by Lars
01:31
created

KeepOriginalValueLexer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getNextToken() 0 10 2
1
<?php
2
3
namespace Spatie\Php7to5\PhpParser;
4
5
use PhpParser\Lexer;
6
use PhpParser\Parser\Tokens;
7
8
class KeepOriginalValueLexer extends Lexer // or Lexer\Emulative
9
{
10
    public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null): int
11
    {
12
        $tokenId = parent::getNextToken($value, $startAttributes, $endAttributes);
13
14
        if ($tokenId == Tokens::T_CONSTANT_ENCAPSED_STRING) {
15
            $endAttributes['originalValue'] = '_+*-7-to-5-*+_' . $value . '_+*-7-to-5-*+_';
16
        }
17
18
        return $tokenId;
19
    }
20
}
21