Passed
Push — master ( deecf0...b54cbd )
by Luis
03:32
created

InterfaceVisitor::leaveNode()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 2
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 72
    public function __construct(Definitions $definitions, InterfaceBuilder $builder)
24
    {
25 72
        $this->definitions = $definitions;
26 72
        $this->builder = $builder;
27 72
    }
28
29 54
    public function leaveNode(Node $node)
30
    {
31 54
        if ($node instanceof Interface_) {
32 12
            $this->definitions->add($this->builder->build($node));
33
        }
34 54
    }
35
}
36