Conditions | 4 |
Paths | 3 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | 2 | public function __invoke(ContainerInterface $container, array $options): CachePoolChain |
|
19 | { |
||
20 | if ( |
||
21 | 2 | empty($options['services']) |
|
22 | 2 | || !is_array($options['services']) |
|
23 | ) { |
||
24 | 1 | throw new InvalidConfigException( |
|
25 | 1 | 'You must provide an array of preconfigured cache services to use for the chain' |
|
26 | ); |
||
27 | } |
||
28 | |||
29 | 1 | $skipOnFailure = $options['skipOnFailure'] ?? false; |
|
30 | |||
31 | 1 | $pools = []; |
|
32 | |||
33 | 1 | foreach ($options['services'] as $service) { |
|
34 | 1 | $pools[] = $container->get($service); |
|
35 | } |
||
36 | |||
37 | 1 | return new CachePoolChain($pools, ['skip_on_failure' => $skipOnFailure]); |
|
38 | } |
||
40 |