Passed
Pull Request — master (#22)
by Luis
24:40 queued 21:48
created

InterfaceVisitor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 12
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 3
1
<?php declare(strict_types=1);
2
/**
3
 * PHP version 8.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\Code\Visitors;
9
10
use PhpParser\Node;
11
use PhpParser\Node\Stmt\Interface_;
12
use PhpParser\NodeVisitorAbstract;
13
use PhUml\Code\Codebase;
14
use PhUml\Parser\Code\Builders\InterfaceDefinitionBuilder;
15
16
/**
17
 * It extracts an `InterfaceDefinition` and adds it to the `Codebase`
18
 */
19
final class InterfaceVisitor extends NodeVisitorAbstract
20
{
21 37
    public function __construct(private readonly InterfaceDefinitionBuilder $builder, private readonly Codebase $codebase)
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected T_STRING, expecting T_VARIABLE on line 21 at column 49
Loading history...
22
    {
23
    }
24
25 29
    public function leaveNode(Node $node)
26
    {
27 29
        if ($node instanceof Interface_) {
28 12
            $this->codebase->add($this->builder->build($node));
29
        }
30 29
        return null;
31
    }
32
}
33