Configuration   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getConfigTreeBuilder() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2019 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\ServerBundle\DependencyInjection;
15
16
use OAuth2Framework\ServerBundle\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 $components;
26
27
    /**
28
     * @var string
29
     */
30
    private $alias;
31
32
    /**
33
     * @param Component[] $components
34
     */
35
    public function __construct(string $alias, array $components)
36
    {
37
        $this->alias = $alias;
38
        $this->components = $components;
39
    }
40
41
    public function getConfigTreeBuilder()
42
    {
43
        $treeBuilder = new TreeBuilder($this->alias);
44
        $rootNode = $treeBuilder->getRootNode();
45
46
        foreach ($this->components as $component) {
47
            $component->getNodeDefinition($rootNode, $rootNode);
48
        }
49
50
        return $treeBuilder;
51
    }
52
}
53