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