Completed
Pull Request — master (#4)
by Kévin
03:15
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 4
Bugs 1 Features 1
Metric Value
c 4
b 1
f 1
dl 0
loc 23
ccs 0
cts 21
cp 0
rs 9.0856
cc 1
eloc 19
nc 1
nop 0
crap 2
1
<?php
2
3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace PostmanGeneratorBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15
use Symfony\Component\Config\Definition\ConfigurationInterface;
16
17
/**
18
 * This is the class that validates and merges configuration from your app/config files.
19
 *
20
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
21
 */
22
class Configuration implements ConfigurationInterface
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function getConfigTreeBuilder()
28
    {
29
        $treeBuilder = new TreeBuilder();
30
        $rootNode = $treeBuilder->root('postman_generator');
31
32
        $rootNode
33
            ->children()
34
                ->booleanNode('public')
35
                    ->defaultFalse()
36
                ->end()
37
                ->scalarNode('name')
38
                    ->isRequired()
39
                ->end()
40
                ->scalarNode('baseUrl')
41
                    ->isRequired()
42
                ->end()
43
                ->scalarNode('description')->defaultNull()->end()
44
                ->scalarNode('defaultLocale')->defaultValue('en_GB')->end()
45
                ->scalarNode('authentication')->defaultNull()->end()
46
            ->end();
47
48
        return $treeBuilder;
49
    }
50
}
51