Configuration::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
/*
4
 * This file is part of the doctrineviz package
5
 *
6
 * Copyright (c) 2017 Pierre Hennequart
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * Feel free to edit as you please, and have fun.
12
 *
13
 * @author Pierre Hennequart <[email protected]>
14
 */
15
16
declare(strict_types=1);
17
18
namespace Janalis\Doctrineviz\DependencyInjection;
19
20
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
21
use Symfony\Component\Config\Definition\ConfigurationInterface;
22
23
/**
24
 * This is the class that validates and merges configuration from your app/config files.
25
 *
26
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/configuration.html}
27
 */
28
class Configuration implements ConfigurationInterface
29
{
30
    /** @var string */
31
    private $root;
32
33
    /**
34
     * Configuration constructor.
35
     *
36
     * @param string $root
37
     */
38
    public function __construct(string $root)
39
    {
40
        $this->root = $root;
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function getConfigTreeBuilder(): TreeBuilder
47
    {
48
        $treeBuilder = new TreeBuilder();
49
        $rootNode = $treeBuilder->root($this->getRoot());
50
51
        $rootNode
52
            ->children()
53
            ->end();
54
55
        return $treeBuilder;
56
    }
57
58
    /**
59
     * Get configuration root.
60
     *
61
     * @return string
62
     */
63
    public function getRoot(): string
64
    {
65
        return $this->root;
66
    }
67
}
68