Passed
Pull Request — master (#7)
by Luis
20:14 queued 05:16
created

PhpCodeParser   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
c 0
b 0
f 0
dl 0
loc 13
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
1
<?php declare(strict_types=1);
2
/**
3
 * PHP version 7.2
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;
9
10
use PhpParser\ParserFactory;
0 ignored issues
show
Bug introduced by
The type PhpParser\ParserFactory 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\Parser\Code\Builders\ClassDefinitionBuilder;
12
use PhUml\Parser\Code\Builders\InterfaceDefinitionBuilder;
13
use PhUml\Parser\Code\Builders\TraitDefinitionBuilder;
14
15
/**
16
 * It traverses the AST of all the files and interfaces found by the `CodeFinder` and builds a
17
 * `Codebase` object
18
 *
19
 * In order to create the collection of definitions it uses the following visitors
20
 *
21
 * - The `ClassVisitor` which builds `ClassDefinition`s
22
 * - The `InterfaceVisitor` which builds `InterfaceDefinition`s
23
 * - The `TraitVisitor` which builds `TraitDefinition`s
24
 */
25
final class PhpCodeParser extends PhpParser
26
{
27
    public function __construct(
28
        ClassDefinitionBuilder $classBuilder = null,
29
        InterfaceDefinitionBuilder $interfaceBuilder = null,
30
        TraitDefinitionBuilder $traitBuilder = null
31
    ) {
32
        parent::__construct(
33
            (new ParserFactory())->create(ParserFactory::PREFER_PHP7),
34
            new Php5Traverser(
35
                $classBuilder ?? new ClassDefinitionBuilder(),
36
                $interfaceBuilder ?? new InterfaceDefinitionBuilder(),
37
                $traitBuilder ?? new TraitDefinitionBuilder()
38
            )
39
        );
40
    }
41
}
42