Proxy   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 23
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getAdapter() 0 10 2
1
<?php
2
3
namespace Dafiti\Silex\Cache;
4
5
use Dafiti\Silex\Exception\InvalidCacheConfig;
6
7
class Proxy
8
{
9
    /**
10
     * @var Factorable
11
     */
12
    private $factory;
13
14
    /**
15
     * @param array $params
16
     *
17
     * @return mixed
18
     */
19
    public function getAdapter(array $params)
20
    {
21
        $class = sprintf('\Dafiti\Silex\Cache\Factory\%s', $params['adapter']);
22
        if (!class_exists($class)) {
23
            throw new InvalidCacheConfig('');
24
        }
25
        $this->factory = new $class();
26
27
        return $this->factory->create($params);
28
    }
29
}
30