NodeVariable   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 16
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getNode() 0 9 2
A getVariableName() 0 3 1
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