GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

CacheFactory::arrayCache()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
ccs 2
cts 2
cp 1
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Cmp\Cache\Factory;
4
5
use Cmp\Cache\Backend\ChainCache;
6
use Cmp\Cache\Backend\ArrayCache;
7
use Cmp\Cache\Backend\RedisCache;
8
use Cmp\Cache\Cache;
9
use Cmp\Cache\Decorator\LoggerCache;
10
use Psr\Log\LoggerInterface;
11
use Psr\Log\LogLevel;
12
use Redis;
13
14
/**
15
 * Class CacheFactory
16
 *
17
 * @package Cmp\Cache\Application
18
 */
19
class CacheFactory implements CacheFactoryInterface
20
{
21
    /**
22
     * Builds an array cache
23
     * 
24
     * @return ArrayCache
25
     */
26 1
    public function arrayCache()
27
    {
28 1
        return new ArrayCache();
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34 1
    public function redisFromParams($host = '127.0.0.1', $port = 6379, $db = 0, $timeOut = 0.0)
35
    {
36 1
        $redis = new Redis();
37 1
        $redis->pconnect($host, $port, $timeOut);
38 1
        $redis->select($db);
39
40 1
        return self::redisCache($redis);
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46 1
    public function redisCache(Redis $redis)
47
    {
48 1
        return new RedisCache($redis);
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54 1
    public function chainCache(array $caches = [])
55
    {
56 1
        $chain = new ChainCache();
57 1
        foreach ($caches as $cache) {
58 1
            $chain->pushCache($cache);
59 1
        }
60
61 1
        return $chain;
62
    }
63
64
    /**
65
     * {@inheritdoc}
66
     */
67 1
    public function loggerCache(
68
        Cache $cache,
69
        $withExceptions = true,
70
        LoggerInterface $logger = null,
71
        $logLevel = LogLevel::ERROR
72
    ) {
73 1
        return new LoggerCache($cache, $withExceptions, $logger, $logLevel);
74
    }
75
}
76