Configuration::getConfigTreeBuilder()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 11
rs 9.4285
cc 2
eloc 6
nc 2
nop 0
1
<?php
2
3
/*
4
 * The MIT License (MIT)
5
 *
6
 * Copyright (c) 2014-2016 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 SpomkyLabs\JoseBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15
use Symfony\Component\Config\Definition\ConfigurationInterface;
16
17
final class Configuration implements ConfigurationInterface
18
{
19
    /**
20
     * @var \SpomkyLabs\JoseBundle\DependencyInjection\Source\SourceInterface[]
21
     */
22
    private $service_sources;
23
24
    /**
25
     * @var string
26
     */
27
    private $alias;
28
29
    /**
30
     * Configuration constructor.
31
     *
32
     * @param string                                                              $alias
33
     * @param \SpomkyLabs\JoseBundle\DependencyInjection\Source\SourceInterface[] $service_sources
34
     */
35
    public function __construct($alias, array $service_sources)
36
    {
37
        $this->alias = $alias;
38
        $this->service_sources = $service_sources;
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function getConfigTreeBuilder()
45
    {
46
        $treeBuilder = new TreeBuilder();
47
        $rootNode = $treeBuilder->root($this->alias);
48
49
        foreach ($this->service_sources as $service_source) {
50
            $service_source->getNodeDefinition($rootNode);
51
        }
52
53
        return $treeBuilder;
54
    }
55
}
56