Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B getConfigTreeBuilder() 0 35 1
1
<?php
2
3
/*
4
 * This file is part of the Kickbox Bundle.
5
 *
6
 * (c) Abdoul Ndiaye <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Andi\KickBoxBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15
use Symfony\Component\Config\Definition\ConfigurationInterface;
16
17
/**
18
 * This is the class that validates and merges configuration from your app/config files
19
 *
20
 * To learn more see {
21
 *   @link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class
22
 * }
23
 */
24
class Configuration implements ConfigurationInterface
25
{
26
    const DEFAULT_ENDPOINT = 'https://api.kickbox.io/v2/verify';
27
28
    /**
29
     * {@inheritdoc}
30
     */
31 5
    public function getConfigTreeBuilder()
32
    {
33 5
        $treeBuilder = new TreeBuilder();
34 5
        $rootNode = $treeBuilder->root('andi_kick_box');
35
36
        $rootNode
37 5
            ->children()
38 5
                ->arrayNode('api_keys')
39 5
                ->useAttributeAsKey('name')
40 5
                ->requiresAtLeastOneElement()
41 5
                ->isRequired()
42 5
                ->info('API key list.')
43 5
                    ->prototype('array')
44 5
                        ->children()
45 5
                            ->scalarNode('key')
46 5
                                ->isRequired()
47 5
                                ->cannotBeEmpty()
48 5
                                ->info('The api key generated in kickbox.io.')
49 5
                            ->end()
50 5
                        ->end()
51 5
                    ->end()
52 5
                ->end()
53 5
                ->scalarNode('default_api_name')
54 5
                    ->info('The default API name.')
55 5
                ->end()
56 5
                ->scalarNode('endpoint')
57 5
                    ->info('The endpoint of the kickbox API.')
58 5
                    ->cannotBeEmpty()
59 5
                    ->defaultValue(self::DEFAULT_ENDPOINT)
60 5
                ->end()
61 5
            ->end()
62
        ;
63
64 5
        return $treeBuilder;
65
    }
66
}
67