Total Complexity | 4 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
24 | final class CodeParser |
||
25 | { |
||
26 | public static function fromConfiguration(CodeParserConfiguration $configuration): CodeParser |
||
27 | { |
||
28 | $resolvers = $configuration->extractAssociations() |
||
29 | ? RelationshipsResolvers::withAssociations() |
||
30 | : RelationshipsResolvers::withoutAssociations(); |
||
31 | |||
32 | return new CodeParser(PhpCodeParser::fromConfiguration($configuration), $resolvers); |
||
33 | 111 | } |
|
34 | |||
35 | 111 | private function __construct(private PhpCodeParser $parser, private RelationshipsResolvers $resolvers) |
|
36 | 111 | { |
|
37 | 111 | } |
|
38 | |||
39 | /** |
||
40 | * The parsing process is as follows |
||
41 | * |
||
42 | * 1. Parse the code and populate the `Codebase` with definitions |
||
43 | * 2. Add external definitions (built-in/third party), if needed |
||
44 | */ |
||
45 | 93 | public function parse(SourceCode $sourceCode): Codebase |
|
52 | } |
||
53 | } |
||
54 |