| Conditions | 5 |
| Paths | 8 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 5 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | 5 | public function __invoke(ContainerInterface $container): PredisClient |
|
| 19 | { |
||
| 20 | 5 | $redisConfig = $container->get('config')['redis'] ?? []; |
|
| 21 | 5 | $servers = $redisConfig['servers'] ?? []; |
|
| 22 | |||
| 23 | 5 | if (is_array($servers) && count($servers) === 1) { |
|
| 24 | 1 | $servers = array_shift($servers); |
|
| 25 | } |
||
| 26 | |||
| 27 | 5 | $options = is_string($servers) || count($servers) < 1 ? null : ['cluster' => 'redis']; |
|
| 28 | 5 | return new PredisClient($servers, $options); |
|
| 29 | } |
||
| 31 |