Configuration   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 15.79%

Importance

Changes 0
Metric Value
wmc 9
c 0
b 0
f 0
lcom 1
cbo 0
dl 0
loc 77
ccs 3
cts 19
cp 0.1579
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getClasses() 0 4 1
A getActions() 0 4 1
A getRoute() 0 4 1
A getParameters() 0 4 1
A getComplementaryObjects() 0 8 2
A actionExist() 0 4 1
A classExist() 0 4 1
1
<?php
2
3
namespace Happyr\BlazeBundle\Model;
4
5
/**
6
 * @author Tobias Nyholm <[email protected]>
7
 */
8
class Configuration implements ConfigurationInterface
9
{
10
    /**
11
     * @var array config
12
     *
13
     * This holds the configuration from the file
14
     */
15
    protected $config;
16
17
    /**
18
     * @param array $config
19
     */
20 1
    public function __construct(array $config)
21
    {
22 1
        $this->config = $config;
23 1
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function getClasses()
29
    {
30
        return array_keys($this->config);
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function getActions($class)
37
    {
38
        return array_keys($this->config[$class]);
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function getRoute($class, $action)
45
    {
46
        return $this->config[$class][$action]['route'];
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function getParameters($class, $action)
53
    {
54
        return $this->config[$class][$action]['parameters'];
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    public function getComplementaryObjects($class, $action)
61
    {
62
        if (!isset($this->config[$class][$action]['complementaryObjects'])) {
63
            return [];
64
        }
65
66
        return $this->config[$class][$action]['complementaryObjects'];
67
    }
68
69
    /**
70
     * {@inheritdoc}
71
     */
72
    public function actionExist($class, $action)
73
    {
74
        return array_key_exists($action, $this->config[$class]);
75
    }
76
77
    /**
78
     * {@inheritdoc}
79
     */
80
    public function classExist($class)
81
    {
82
        return array_key_exists($class, $this->config);
83
    }
84
}
85