Configuration::getConfigTreeBuilder()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 40
Code Lines 36

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 35
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 40
ccs 35
cts 35
cp 1
rs 8.8571
cc 1
eloc 36
nc 1
nop 0
crap 1
1
<?php
2
3
namespace EmanueleMinotto\SafeBrowsingBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
/**
9
 * {@inheritdoc}
10
 */
11
class Configuration implements ConfigurationInterface
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16 3
    public function getConfigTreeBuilder()
17
    {
18 3
        $treeBuilder = new TreeBuilder();
19 3
        $rootNode = $treeBuilder->root('safe_browsing');
20
21
        $rootNode
22 3
            ->children()
23 3
                ->arrayNode('configs')
24 3
                    ->children()
25 3
                        ->scalarNode('client')
26 3
                            ->defaultValue('app')
27 3
                            ->info('The client name')
28 3
                        ->end()
29 3
                        ->scalarNode('appver')
30 3
                            ->defaultValue('1.0.0')
31 3
                            ->info('The version of the client')
32 3
                        ->end()
33 3
                        ->scalarNode('key')
34 3
                            ->info('API key')
35 3
                            ->isRequired()
36 3
                        ->end()
37 3
                        ->enumNode('pver')
38 3
                            ->defaultValue(3.1)
39 3
                            ->info('The protocol version supported')
40 3
                            ->values([3.0, 3.1])
41 3
                        ->end()
42 3
                    ->end()
43 3
                ->end()
44 3
                ->scalarNode('cache')
45 3
                    ->defaultNull()
46 3
                    ->info('Caching service')
47 3
                ->end()
48 3
                ->scalarNode('http_client')
49 3
                    ->defaultNull()
50 3
                    ->info('HTTP client service')
51 3
                ->end()
52 3
            ->end();
53
54 3
        return $treeBuilder;
55
    }
56
}
57