Failed Conditions
Push — ng ( e90992...13fb6e )
by Florent
17:32
created

Configuration::buildFromSources()   B

Complexity

Conditions 5
Paths 4

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

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