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

CacheFactory::make()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3.0261

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 3
eloc 6
c 3
b 0
f 0
nc 3
nop 1
dl 0
loc 9
ccs 6
cts 7
cp 0.8571
crap 3.0261
rs 10
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