Completed
Push — 2.x ( 47c14a...69bf09 )
by Akihito
11s queued 10s
created

CodeVisitor   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 30
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A enterNode() 0 12 4
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