NodeVariable::getVariableName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
/**
4
 * @license     http://opensource.org/licenses/mit-license.php MIT
5
 * @link        https://github.com/nicoSWD
6
 * @author      Nicolas Oelgart <[email protected]>
7
 */
8
namespace nicoSWD\Rule\TokenStream\Node;
9
10
use nicoSWD\Rule\TokenStream\Token\BaseToken;
11
12
final class NodeVariable extends BaseNode
13
{
14 140
    public function getNode(): BaseToken
15
    {
16 140
        $token = $this->tokenStream->getVariable($this->getVariableName());
17
18 136
        while ($this->hasMethodCall()) {
19 82
            $token = $this->getMethod($token)->call(...$this->getArguments());
20
        }
21
22 102
        return $token;
23
    }
24
25 140
    private function getVariableName(): string
26
    {
27 140
        return $this->getCurrentNode()->getOriginalValue();
28
    }
29
}
30