Completed
Pull Request — master (#41)
by Lars
03:14
created

KeepOriginalValueLexer::getNextToken()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
cc 2
nc 2
nop 3
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
        // DEBUG
15
        //var_dump($tokenId, $value);
16
17
        if ($tokenId == Tokens::T_CONSTANT_ENCAPSED_STRING) {
18
            $endAttributes['originalValue'] = '_+*-7-to-5-*+_' . $value . '_+*-7-to-5-*+_';
19
        }
20
21
        return $tokenId;
22
    }
23
}
24