Completed
Push — master ( da25a8...3972c2 )
by Simonas
28:32
created

Configuration::getConfigTreeBuilder()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 33
Code Lines 26

Duplication

Lines 0
Ratio 0 %

Importance

Changes 6
Bugs 0 Features 1
Metric Value
c 6
b 0
f 1
dl 0
loc 33
rs 8.8571
cc 1
eloc 26
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[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 ONGR\RouterBundle\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
21
 *      {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
22
 */
23
class Configuration implements ConfigurationInterface
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function getConfigTreeBuilder()
29
    {
30
        $treeBuilder = new TreeBuilder();
31
        $rootNode = $treeBuilder->root('ongr_router');
32
33
        $rootNode
34
            ->children()
35
                ->booleanNode('enable')
36
                    ->defaultTrue()
37
                    ->info('Replace default Symfony router with chain router')
38
                ->end()
39
                ->scalarNode('manager')
40
                    ->defaultValue('es.manager.default')
41
                    ->info('Elasticsearch manager to use in the ONGR default router')
42
                    ->example('es.manager.default')
43
                ->end()
44
                ->arrayNode('routers')
45
                    ->defaultValue(
46
                        [
47
                            'router.default' => 100,
48
                            'ongr_router.dynamic_router' => -100,
49
                        ]
50
                    )
51
                    ->prototype('scalar')->end()
52
                ->end()
53
                ->arrayNode('seo_routes')
54
                    ->defaultValue([])
55
                    ->prototype('scalar')->end()
56
                ->end()
57
            ->end();
58
59
        return $treeBuilder;
60
    }
61
}
62