Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
11.11% |
1 / 9 |
|
33.33% |
1 / 3 |
CRAP | |
0.00% |
0 / 1 |
| BoundedContextConfig | |
11.11% |
1 / 9 |
|
33.33% |
1 / 3 |
9.32 | |
0.00% |
0 / 1 |
| addRawConfig | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| addEntityNamespace | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |||
| toArray | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\IntegrationTests\Config; |
| 3 | |
| 4 | use Apie\Common\ValueObjects\EntityNamespace; |
| 5 | use Apie\Core\BoundedContext\BoundedContextId; |
| 6 | |
| 7 | final class BoundedContextConfig |
| 8 | { |
| 9 | /** |
| 10 | * @var array<string, array<string, mixed>> $boundedContexts |
| 11 | */ |
| 12 | private array $boundedContexts = []; |
| 13 | |
| 14 | /** |
| 15 | * @param array<string, mixed> $rawConfig |
| 16 | */ |
| 17 | public function addRawConfig(BoundedContextId $boundedContextId, array $rawConfig): self |
| 18 | { |
| 19 | $this->boundedContexts[$boundedContextId->toNative()] = $rawConfig; |
| 20 | |
| 21 | return $this; |
| 22 | } |
| 23 | |
| 24 | public function addEntityNamespace( |
| 25 | BoundedContextId $boundedContextId, |
| 26 | string $path, |
| 27 | EntityNamespace $entityNamespace |
| 28 | ): self { |
| 29 | return $this->addRawConfig($boundedContextId, [ |
| 30 | 'entities_folder' => $path . DIRECTORY_SEPARATOR . 'Resources', |
| 31 | 'entities_namespace' => $entityNamespace . 'Resources', |
| 32 | 'actions_folder' => $path . DIRECTORY_SEPARATOR . 'Actions', |
| 33 | 'actions_namespace' => $entityNamespace . 'Actions', |
| 34 | ]); |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * @return array<string, array<string, mixed>> |
| 39 | */ |
| 40 | public function toArray(): array |
| 41 | { |
| 42 | return $this->boundedContexts; |
| 43 | } |
| 44 | } |