Completed
Push — master ( 95511f...afa343 )
by Peter
08:54 queued 05:54
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 17
ccs 14
cts 14
cp 1
rs 9.4285
cc 1
eloc 14
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\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
     *
27
     * @return TreeBuilder
28
     */
29 3
    public function getConfigTreeBuilder()
30
    {
31 3
        return (new TreeBuilder())
32 3
            ->root('anime_db_shikimori_browser')
33 3
                ->children()
34 3
                    ->scalarNode('host')
35 3
                        ->cannotBeEmpty()
36 3
                        ->defaultValue('https://shikimori.org')
37 3
                    ->end()
38 3
                    ->scalarNode('prefix')
39 3
                        ->cannotBeEmpty()
40 3
                        ->defaultValue('/api/')
41 3
                    ->end()
42 3
                ->end()
43 3
            ->end()
44
        ;
45
    }
46
}
47