Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 4 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | 4 | public function __invoke(ContainerInterface $container): ToggleConfig |
|
19 | { |
||
20 | /** |
||
21 | * @var array{pheature_flags?: ToggleConfigOptions|null}|ArrayObject<string, ToggleConfigOptions|null> $config |
||
22 | */ |
||
23 | 4 | $config = $container->get('config'); |
|
24 | 4 | if ($config instanceof ArrayObject) { |
|
25 | 1 | $config = $config->getArrayCopy(); |
|
26 | } |
||
27 | |||
28 | 4 | Assert::keyExists($config, 'pheature_flags', self::MISSING_CONFIG); |
|
29 | 3 | Assert::isArray($config['pheature_flags'], self::MISSING_CONFIG); |
|
30 | |||
31 | 3 | return new ToggleConfig($config['pheature_flags']); |
|
32 | } |
||
34 |