Completed
Pull Request — 2.x (#102)
by Akihito
04:01 queued 02:51
created

CodeVisitor::enterNode()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 4
nc 8
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ray\Aop;
6
7
use PhpParser\Node;
8
use PhpParser\Node\Stmt\Declare_;
9
use PhpParser\Node\Stmt\Namespace_;
10
use PhpParser\Node\Stmt\Use_;
11
use PhpParser\NodeVisitorAbstract;
12
13
final class CodeVisitor extends NodeVisitorAbstract
14
{
15
    /**
16
     * @var Namespace_
17
     */
18
    public $namespace;
19
20
    /**
21
     * @var Declare_[]
22
     */
23
    public $declare = [];
24
25
    /**
26
     * @var Use_[]
27
     */
28
    public $use = [];
29
30
    public function enterNode(Node $node)
31
    {
32
        if ($node instanceof Declare_) {
33
            $this->declare[] = $node;
34
        }
35
        if ($node instanceof Use_) {
36
            $this->use[] = $node;
37
        }
38
        if ($node instanceof Namespace_) {
39
            $this->namespace = $node;
40
        }
41
    }
42
}
43