Passed
Pull Request — master (#212)
by
unknown
04:17 queued 02:05
created

CacheFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 85.71%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 7
c 3
b 0
f 0
dl 0
loc 21
ccs 6
cts 7
cp 0.8571
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A make() 0 9 3
1
<?php
2
3
namespace TusPhp\Cache;
4
5
class CacheFactory
6
{
7
8
    /**
9
     * Make cache.
10
     *
11
     * @param string $type
12
     *
13
     * @static
14
     *
15
     * @return Cacheable
16
     */
17 2
    public static function make(string $type = 'file'): Cacheable
18
    {
19 2
        switch ($type) {
20 2
            case 'redis':
21 1
                return new RedisStore;
22 2
            case 'apcu':
23
                return new ApcuStore;
24
        }
25 2
        return new FileStore;
26
    }
27
}
28