Passed
Push — develop ( d6d0d2...d144b2 )
by Kevin
02:38
created

CacheFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getCache() 0 16 4
1
<?php
2
3
namespace Magium\Configuration\Manager;
4
5
use Zend\Cache\StorageFactory;
6
7
class CacheFactory
8
{
9
10
    public function getCache(\SimpleXMLElement $element)
11
    {
12
        $config = [
13
            'adapter'   => (string)$element->adapter,
14
            'options'   => []
15
        ];
16
        if (isset($element->options)) {
17
            foreach ($element->options->children() as $value) {
18
                if ($value instanceof \SimpleXMLElement) {
19
                    $config['options'][$value->getName()] = (string)$value;
20
                }
21
            }
22
        }
23
        $cache = StorageFactory::factory($config);
24
        return $cache;
25
    }
26
27
}
28