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