Configuration::getConfigTreeBuilder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 22
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 21
nc 1
nop 0
dl 0
loc 23
ccs 22
cts 22
cp 1
crap 1
rs 9.0856
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\AnimeNewsNetworkBrowserBundle\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_anime_news_network_browser:
25
     *     host: 'https://cdn.animenewsnetwork.cc'
26
     *     reports: '/encyclopedia/reports.xml'
27
     *     details: '/encyclopedia/api.xml'
28
     *     client: 'My Custom Bot 1.0'
29
     *
30
     * @return ArrayNodeDefinition
31
     */
32 3
    public function getConfigTreeBuilder()
33
    {
34 3
        return (new TreeBuilder())
35 3
            ->root('anime_db_anime_news_network_browser')
36 3
                ->children()
37 3
                    ->scalarNode('host')
38 3
                        ->defaultValue('https://cdn.animenewsnetwork.cc')
39 3
                        ->cannotBeEmpty()
40 3
                    ->end()
41 3
                    ->scalarNode('reports')
42 3
                        ->defaultValue('/encyclopedia/reports.xml')
43 3
                        ->cannotBeEmpty()
44 3
                    ->end()
45 3
                    ->scalarNode('details')
46 3
                        ->defaultValue('/encyclopedia/api.xml')
47 3
                        ->cannotBeEmpty()
48 3
                    ->end()
49 3
                    ->scalarNode('client')
50 3
                        ->defaultValue('')
51 3
                        ->cannotBeEmpty()
52 3
                    ->end()
53 3
                ->end()
54 3
            ->end()
55
        ;
56
    }
57
}
58