Configuration::getConfigTreeBuilder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 18
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 23
rs 9.6666
1
<?php
2
3
/**
4
 * This file is part of the bugloos/api-versioning-bundle project.
5
 * (c) Bugloos <https://bugloos.com/>
6
 * For the full copyright and license information, please view
7
 * the LICENSE file that was distributed with this source code.
8
 */
9
10
namespace Bugloos\ApiVersioningBundle\DependencyInjection;
11
12
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
13
use Symfony\Component\Config\Definition\ConfigurationInterface;
14
15
/**
16
 * @author Mojtaba Gheytasi <[email protected]>
17
 */
18
class Configuration implements ConfigurationInterface
19
{
20
    public function getConfigTreeBuilder(): TreeBuilder
21
    {
22
        $treeBuilder = new TreeBuilder('bugloos_api_versioning');
23
24
        $rootNode = $treeBuilder->getRootNode();
25
26
        $rootNode
27
            ->children()
28
                ->scalarNode('base_version')
29
                    ->defaultValue('v1.0')
30
                ->end()
31
                ->arrayNode('next_versions')
32
                    ->scalarPrototype()
33
                    ->end()
34
                ->defaultValue([])
35
                ->end()
36
                ->arrayNode('deleted_routes')
37
                    ->variablePrototype()
38
                    ->end()
39
                ->defaultValue([])
40
            ->end();
41
42
        return $treeBuilder;
43
    }
44
}
45