Passed
Push — 2.0 ( 0701c6 )
by Luis
47s queued 12s
created

PhpCodeParser::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
c 0
b 0
f 0
nc 1
nop 3
dl 0
loc 11
rs 10
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\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
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