Service::__construct()   A
last analyzed

Complexity

Conditions 4
Paths 6

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 4
nc 6
nop 1
dl 0
loc 8
rs 9.2
c 0
b 0
f 0
1
<?php
2
3
namespace Devmachine\Bundle\ServicesInjectorBundle\Configuration;
4
5
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ConfigurationInterface;
6
7
/**
8
 * @Annotation
9
 */
10
class Service implements ConfigurationInterface
11
{
12
    private $aliases = [];
13
14
    public function __construct(array $data)
15
    {
16
        if (isset($data['value'])) {
17
            $data = (array) $data['value'];
18
        }
19
20
        foreach ($data as $key => $value) {
21
            $this->aliases[is_numeric($key) ? $value : $key] = $value;
22
        }
23
    }
24
25
    /**
26
     * @return array
27
     */
28
    public function getAliases()
29
    {
30
        return $this->aliases;
31
    }
32
33
    public function getAliasName()
34
    {
35
        return 'services';
36
    }
37
38
    public function allowArray()
39
    {
40
        return true;
41
    }
42
}
43