Passed
Push — master ( 4f7618...5b2171 )
by Peter
03:16
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 12
nc 1
nop 0
dl 0
loc 14
ccs 13
cts 13
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
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\MyAnimeListBrowserBundle\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_my_anime_list_browser:
25
     *     host: 'http://myanimelist.net'
26
     *     client: 'My Custom Bot 1.0'
27
     *
28
     * @return ArrayNodeDefinition
29
     */
30 3
    public function getConfigTreeBuilder()
31
    {
32 3
        return (new TreeBuilder())
33 3
            ->root('anime_db_my_anime_list_browser')
34 3
                ->children()
35 3
                    ->scalarNode('host')
36 3
                        ->defaultValue('http://myanimelist.net')
37 3
                        ->cannotBeEmpty()
38 3
                    ->end()
39 3
                    ->scalarNode('client')
40 3
                        ->defaultValue('')
41 3
                    ->end()
42 3
                ->end()
43 3
            ->end()
44
        ;
45
    }
46
}
47