Configuration::getConfigTreeBuilder()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 32
Code Lines 28

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 32
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 28
nc 1
nop 0
1
<?php
2
3
namespace Psi\Bundle\Description\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
/**
9
 * This is the class that validates and merges configuration from your app/config files.
10
 *
11
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/configuration.html}
12
 */
13
class Configuration implements ConfigurationInterface
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function getConfigTreeBuilder()
19
    {
20
        $treeBuilder = new TreeBuilder();
21
        $rootNode = $treeBuilder->root('psi_description');
22
        $rootNode->addDefaultsIfNotSet();
23
        $rootNode->children()
24
            ->arrayNode('enhancers')
25
                ->info('Enabled description enhancers')
26
                ->prototype('scalar')->end()
27
            ->end()
28
            ->arrayNode('subject_resolvers')
29
                ->info('Enabled subject resolvers')
30
                ->prototype('scalar')->end()
31
            ->end()
32
            ->arrayNode('schema')
33
                ->addDefaultsIfNotSet()
34
                ->children()
35
                    ->booleanNode('enabled')
36
                        ->info('Enable schema to validate the description. (Can be disabled in prod environment)')
37
                        ->defaultValue(true)
38
                    ->end()
39
                    ->arrayNode('extensions')
40
                        ->info('Enabled schema extensions')
41
                        ->defaultValue(['std'])
42
                        ->prototype('scalar')->end()
43
                    ->end()
44
                ->end()
45
            ->end();
46
47
48
        return $treeBuilder;
49
    }
50
}
51