Failed Conditions
Push — v7 ( 477009...5356df )
by Florent
03:33
created

Configuration::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
/*
4
 * The MIT License (MIT)
5
 *
6
 * Copyright (c) 2014-2017 Spomky-Labs
7
 *
8
 * This software may be modified and distributed under the terms
9
 * of the MIT license.  See the LICENSE file for details.
10
 */
11
12
namespace Jose\Bundle\JoseFramework\DependencyInjection;
13
14
use Jose\Bundle\JoseFramework\DependencyInjection\Source\SourceInterface;
15
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
16
use Symfony\Component\Config\Definition\ConfigurationInterface;
17
18
final class Configuration implements ConfigurationInterface
19
{
20
    /**
21
     * @var SourceInterface[]
22
     */
23
    private $serviceSources;
24
25
    /**
26
     * @var string
27
     */
28
    private $alias;
29
30
    /**
31
     * Configuration constructor.
32
     *
33
     * @param string            $alias
34
     * @param SourceInterface[] $serviceSources
35
     */
36
    public function __construct(string $alias, array $serviceSources)
37
    {
38
        $this->alias = $alias;
39
        $this->serviceSources = $serviceSources;
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function getConfigTreeBuilder()
46
    {
47
        $treeBuilder = new TreeBuilder();
48
        $rootNode = $treeBuilder->root($this->alias);
49
50
        foreach ($this->serviceSources as $serviceSource) {
51
            $serviceSource->getNodeDefinition($rootNode);
52
        }
53
54
        return $treeBuilder;
55
    }
56
}
57