Conditions | 2 |
Paths | 2 |
Total Lines | 24 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | public function process(ContainerBuilder $container): void |
||
17 | { |
||
18 | 1 | /** @var array<array<mixed>> $pheatureFlagsConfig */ |
|
19 | 1 | $pheatureFlagsConfig = $container->getExtensionConfig('pheature_flags'); |
|
20 | $mergedConfig = array_merge(...$pheatureFlagsConfig); |
||
21 | 1 | ||
22 | 1 | $segmentFactory = $container->register(SegmentFactory::class, SegmentFactory::class) |
|
23 | 1 | ->setAutowired(false) |
|
24 | 1 | ->setLazy(true) |
|
25 | ->setClass(ChainSegmentFactory::class); |
||
26 | 1 | ||
27 | 1 | Assert::keyExists($mergedConfig, 'segment_types'); |
|
28 | 1 | Assert::isArray($mergedConfig['segment_types']); |
|
29 | 1 | ||
30 | foreach ($mergedConfig['segment_types'] as $segmentDefinition) { |
||
31 | 1 | Assert::keyExists($segmentDefinition, 'type'); |
|
32 | Assert::string($segmentDefinition['type']); |
||
33 | 1 | Assert::keyExists($segmentDefinition, 'factory_id'); |
|
34 | Assert::string($segmentDefinition['factory_id']); |
||
35 | $container->register($segmentDefinition['type'], $segmentDefinition['factory_id']) |
||
36 | ->setAutowired(false) |
||
37 | ->setLazy(true); |
||
38 | |||
39 | $segmentFactory->addArgument(new Reference($segmentDefinition['type'])); |
||
40 | } |
||
43 |