NamespaceDetection::namespace()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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