Passed
Push — parser-refactoring ( e758c6...b54cbd )
by Luis
11:11
created

InterfaceVisitor::leaveNode()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * PHP version 7.1
4
 *
5
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
6
 */
7
8
namespace PhUml\Parser;
9
10
use PhpParser\Node;
11
use PhpParser\Node\Stmt\Interface_;
12
use PhpParser\NodeVisitorAbstract;
13
use PhUml\Parser\Builders\InterfaceBuilder;
14
15
class InterfaceVisitor extends NodeVisitorAbstract
16
{
17
    /** @var Definitions */
18
    private $definitions;
19
20
    /** @var InterfaceBuilder */
21
    private $builder;
22
23
    public function __construct(Definitions $definitions, InterfaceBuilder $builder)
24
    {
25
        $this->definitions = $definitions;
26
        $this->builder = $builder;
27
    }
28
29
    public function leaveNode(Node $node)
30
    {
31
        if ($node instanceof Interface_) {
32
            $this->definitions->add($this->builder->build($node));
33
        }
34
    }
35
}
36