| Conditions | 5 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 5 | private function buildAdapter(array $config, ContainerInterface $container): Cache\CacheProvider |
|
| 34 | { |
||
| 35 | 5 | $isDebug = (bool) ($config['debug'] ?? false); |
|
| 36 | 5 | $redisConfig = $config['cache']['redis'] ?? null; |
|
| 37 | 5 | $apcuEnabled = ($this->apcuEnabled)(); |
|
| 38 | |||
| 39 | 5 | if ($isDebug || (! $apcuEnabled && $redisConfig === null)) { |
|
| 40 | 2 | return new Cache\ArrayCache(); |
|
| 41 | } |
||
| 42 | |||
| 43 | 3 | if ($redisConfig === null) { |
|
| 44 | 2 | return new Cache\ApcuCache(); |
|
| 45 | } |
||
| 46 | |||
| 47 | /** @var PredisClient $predis */ |
||
| 48 | 1 | $predis = $container->get(RedisFactory::SERVICE_NAME); |
|
| 49 | 1 | return new Cache\PredisCache($predis); |
|
| 50 | } |
||
| 52 |