Completed
Push — master ( e4a414...d6bcbc )
by Peter
05:51
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 13
cts 13
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 13
nc 1
nop 0
crap 1
1
<?php
2
3
/**
4
 * AnimeDb package.
5
 *
6
 * @author    Peter Gribanov <[email protected]>
7
 * @copyright Copyright (c) 2011, Peter Gribanov
8
 * @license   http://opensource.org/licenses/GPL-3.0 GPL v3
9
 */
10
11
namespace AnimeDb\Bundle\WorldArtBrowserBundle\DependencyInjection;
12
13
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15
use Symfony\Component\Config\Definition\ConfigurationInterface;
16
17
class Configuration implements ConfigurationInterface
18
{
19
    /**
20
     * Config tree builder.
21
     *
22
     * Example config:
23
     *
24
     * anime_db_world_art_browser:
25
     *     host: 'http://www.world-art.ru'
26
     *     client: 'My Custom Bot 1.0'
27
     *
28
     * @return ArrayNodeDefinition
29
     */
30 2
    public function getConfigTreeBuilder()
31
    {
32 2
        return (new TreeBuilder())
33 2
            ->root('anime_db_world_art_browser')
34 2
                ->children()
35 2
                    ->scalarNode('host')
36 2
                        ->defaultValue('http://www.world-art.ru')
37 2
                        ->cannotBeEmpty()
38 2
                    ->end()
39 2
                    ->scalarNode('client')
40 2
                        ->defaultValue('')
41 2
                    ->end()
42 2
                ->end()
43 2
            ->end()
44
        ;
45
    }
46
}
47