Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 36
ccs 18
cts 18
cp 1
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 21 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\ShikimoriBrowserBundle\DependencyInjection;
12
13
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
14
use Symfony\Component\Config\Definition\ConfigurationInterface;
15
16
class Configuration implements ConfigurationInterface
17
{
18
    /**
19
     * Config tree builder.
20
     *
21
     * Example config:
22
     *
23
     * anime_db_shikimori_browser:
24
     *     host: 'https://shikimori.org'
25
     *     prefix: '/api/'
26
     *     client: 'My Custom Bot 1.0'
27
     *
28
     * @return TreeBuilder
29
     */
30 3
    public function getConfigTreeBuilder()
31
    {
32 3
        return (new TreeBuilder())
33 3
            ->root('anime_db_shikimori_browser')
34 3
                ->children()
35 3
                    ->scalarNode('host')
36 3
                        ->cannotBeEmpty()
37 3
                        ->defaultValue('https://shikimori.org')
38 3
                    ->end()
39 3
                    ->scalarNode('prefix')
40 3
                        ->cannotBeEmpty()
41 3
                        ->defaultValue('/api/')
42 3
                    ->end()
43 3
                    ->scalarNode('client')
44 3
                        ->cannotBeEmpty()
45 3
                        ->isRequired()
46 3
                    ->end()
47 3
                ->end()
48 3
            ->end()
49
        ;
50
    }
51
}
52