CacheFactory::make()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 3
eloc 6
c 2
b 0
f 0
nc 3
nop 1
dl 0
loc 9
ccs 7
cts 7
cp 1
crap 3
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 1
                return new ApcuStore;
24
        }
25 2
        return new FileStore;
26
    }
27
}
28