CacheBootloader   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A makeCache() 0 4 1
1
<?php
2
3
namespace Spiral\PhpFastCache;
4
5
use phpFastCache\CacheManager;
6
use Psr\Cache\CacheItemPoolInterface;
7
use Psr\SimpleCache\CacheInterface;
8
use Spiral\Core\Bootloaders\Bootloader;
9
10
class CacheBootloader extends Bootloader
11
{
12
    const BINDINGS = [
13
        'cache'               => CacheInterface::class,
14
        CacheInterface::class => SimpleCacheAdapter::class
15
    ];
16
17
    const SINGLETONS = [
18
        CacheItemPoolInterface::class => [self::class, 'makeCache']
19
    ];
20
21
    protected function makeCache(Config $config): CacheItemPoolInterface
22
    {
23
        return CacheManager::getInstance($config->getAdapter(), $config->getAdapterOptions());
24
    }
25
}