CacheFactory::getCache()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 7
cts 7
cp 1
rs 9.8333
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Magium\Configuration\Manager;
4
5
use Zend\Cache\StorageFactory;
6
7
class CacheFactory
8
{
9
10 5
    public function getCache(\SimpleXMLElement $element)
11
    {
12
        $config = [
13 5
            'adapter'   => (string)$element->adapter,
14
            'options'   => []
15
        ];
16 5
        if (isset($element->options)) {
17 3
            $options = json_encode($element->options);
18 3
            $config['options'] = json_decode($options, true);
19
        }
20 5
        $cache = StorageFactory::factory($config);
21 5
        return $cache;
22
    }
23
24
}
25