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.
Completed
Push — master ( 2f12c3...e53ef5 )
by Hilari
02:46
created

CacheFactory::redisFromParams()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 4
1
<?php
2
3
namespace Cmp\Cache\Application;
4
5
use Cmp\Cache\Domain\Cache;
6
use Cmp\Cache\Infrastructure\ArrayCache;
7
use Cmp\Cache\Infrastructure\RedisCache;
8
use Redis;
9
10
/**
11
 * Class CacheFactory
12
 *
13
 * @package Cmp\Cache\Application
14
 */
15
class CacheFactory
16
{
17
    /**
18
     * @return ArrayCache
19
     */
20
    public static function arrayCache()
21
    {
22
        return new ArrayCache();
23
    }
24
25
    /**
26
     * @param       $host
27
     * @param       $port
28
     * @param int   $db
29
     * @param float $timeOut
30
     *
31
     * @return RedisCache
32
     */
33
    public static function redisFromParams($host, $port = 6379, $db = 0, $timeOut = 0.0)
34
    {
35
        $redis = new Redis();
36
        $redis->pconnect($host, $port, $timeOut);
37
        $redis->select($db);
38
39
        return self::redisCache($redis);
40
    }
41
42
    /**
43
     * @param Redis $redis
44
     *
45
     * @return RedisCache
46
     */
47
    public static function redisCache(Redis $redis)
48
    {
49
        return new RedisCache($redis);
50
    }
51
52
    /**
53
     * @param Cache $cache
54
     *
55
     * @return TestCacheDecorator
56
     */
57
    public static function decorateForTesting(Cache $cache)
58
    {
59
        return new TestCacheDecorator($cache);
60
    }
61
}
62