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

InterfaceVisitor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A leaveNode() 0 4 2
A __construct() 0 4 1
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