Completed
Push — master ( 74d8c1...00f6f4 )
by Westin
08:22
created

CacheMapper::getFactoryClassName()   B

Complexity

Conditions 5
Paths 5

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 5

Importance

Changes 0
Metric Value
dl 0
loc 17
ccs 8
cts 8
cp 1
rs 8.8571
c 0
b 0
f 0
cc 5
eloc 11
nc 5
nop 1
crap 5
1
<?php
2
declare(strict_types=1);
3
4
namespace WShafer\PSR11FlySystem\Cache;
5
6
use WShafer\PSR11FlySystem\MapperAbstract;
7
8
class CacheMapper extends MapperAbstract
9
{
10 4
    public function getFactoryClassName(string $type)
11
    {
12 4
        if (class_exists($type)) {
13 1
            return $type;
14
        }
15
16
        switch ($type) {
17 3
            case 'psr6':
18 1
                return Psr6CacheFactory::class;
19 2
            case 'memory':
20 1
                return MemoryCacheFactory::class;
21
            case 'predis':
22
                return PredisCacheFactory::class;
23 1
        }
24
25
        return null;
26
    }
27
}
28