Configuration::getComplementaryObjects()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 6
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