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

Configuration   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 39
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getConfigTreeBuilder() 0 11 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