Passed
Pull Request — master (#23)
by
unknown
13:36 queued 10:51
created

ClassVisitor::leaveNode()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 6
nc 3
nop 1
dl 0
loc 10
ccs 7
cts 7
cp 1
crap 3
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
/**
3
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
4
 */
5
6
namespace PhUml\Parser\Code\Visitors;
7
8
use PhpParser\Node;
0 ignored issues
show
Bug introduced by
The type PhpParser\Node was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use PhpParser\Node\Stmt\Class_;
0 ignored issues
show
Bug introduced by
The type PhpParser\Node\Stmt\Class_ was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use PhpParser\NodeVisitorAbstract;
0 ignored issues
show
Bug introduced by
The type PhpParser\NodeVisitorAbstract was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use PhUml\Code\Codebase;
12
use PhUml\Parser\Code\Builders\ClassDefinitionBuilder;
13
14
/**
15
 * It extracts a `ClassDefinition` and adds it to the `Codebase`
16
 */
17
final class ClassVisitor extends NodeVisitorAbstract
18
{
19 38
    public function __construct(private readonly ClassDefinitionBuilder $builder, private readonly Codebase $codebase)
20
    {
21
    }
22
23 30
    public function leaveNode(Node $node)
24
    {
25 30
        if (! $node instanceof Class_) {
26 29
            return null;
27
        }
28 28
        if ($node->isAnonymous()) {
29 1
            return null;
30
        }
31 27
        $this->codebase->add($this->builder->build($node));
32 27
        return null;
33
    }
34
}
35