Configuration::getConfigTreeBuilder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 9.2
c 0
b 0
f 0
cc 1
eloc 18
nc 1
nop 0
1
<?php
2
3
namespace Fruitware\YandexGeocoderBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
class Configuration implements ConfigurationInterface
9
{
10
    /**
11
     * Generates the configuration tree.
12
     *
13
     * @return TreeBuilder
14
     */
15
    public function getConfigTreeBuilder()
16
    {
17
        $treeBuilder = new TreeBuilder();
18
        $rootNode = $treeBuilder->root('fruitware_yandex_geocoder', 'array');
19
        $rootNode
20
            ->children()
21
                ->scalarNode('key')->defaultNull()->end()
22
                ->scalarNode('version')->cannotBeEmpty()->defaultValue('1.x')->end()
23
                ->enumNode('lang')
24
                    ->cannotBeEmpty()
25
                    ->defaultValue('ru-RU')
26
                    ->values(array('ru-RU', 'uk-UA', 'be-BY', 'en-US', 'en-BR', 'tr-TR'))
27
                ->end()
28
                ->enumNode('kind')
29
                    ->defaultNull()
30
                    ->values(array('house', 'street', 'metro', 'district', 'locality'))
31
                ->end()
32
            ->end()
33
        ;
34
35
        return $treeBuilder;
36
    }
37
}