NamespaceDetection::enterNode()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\PhpGenerics\Dissector\Visitor;
4
5
use PhpParser\Node;
6
use PhpParser\NodeVisitorAbstract;
7
8
final class NamespaceDetection extends NodeVisitorAbstract
9
{
10
    private $namespace = '';
11
12
    public function enterNode(Node $node)
13
    {
14
        if ($node instanceof Node\Stmt\Namespace_) {
15
            $this->namespace = (string) $node->name;
16
        }
17
    }
18
19
    public function namespace(): string
20
    {
21
        return $this->namespace;
22
    }
23
}
24