Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 33
ccs 18
cts 18
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 19 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\SmotretAnimeBrowserBundle\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_smotret_anime_browser:
25
     *     host: 'http://smotret-anime.ru'
26
     *     prefix: '/api/'
27
     *     client: 'My Custom Bot 1.0'
28
     *
29
     * @return ArrayNodeDefinition
30
     */
31 3
    public function getConfigTreeBuilder()
32
    {
33 3
        return (new TreeBuilder())
34 3
            ->root('anime_db_smotret_anime_browser')
35 3
                ->children()
36 3
                    ->scalarNode('host')
37 3
                        ->defaultValue('http://smotret-anime.ru')
38 3
                        ->cannotBeEmpty()
39 3
                    ->end()
40 3
                    ->scalarNode('prefix')
41 3
                        ->defaultValue('/api/')
42 3
                        ->cannotBeEmpty()
43 3
                    ->end()
44 3
                    ->scalarNode('client')
45 3
                        ->cannotBeEmpty()
46 3
                        ->isRequired()
47 3
                    ->end()
48 3
                ->end()
49 3
            ->end()
50 3
        ;
51
    }
52
}
53