Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 30
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B getConfigTreeBuilder() 0 24 1
1
<?php
2
/**
3
 * OpenExchangeRates Bundle for Symfony2
4
 *
5
 * @author Gonzalo Míguez ([email protected])
6
 * @since 2014
7
 */
8
9
namespace Mrzard\OpenExchangeRatesBundle\DependencyInjection;
10
11
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
12
use Symfony\Component\Config\Definition\ConfigurationInterface;
13
14
/**
15
 * Class Configuration
16
 * This is the class that validates and merges configuration from your app/config files
17
 *
18
 * @package Mrzard\OpenExchangeRatesBundle\DependencyInjection
19
 */
20
class Configuration implements ConfigurationInterface
21
{
22
    /**
23
     * {@inheritDoc}
24
     */
25
    public function getConfigTreeBuilder()
26
    {
27
        $treeBuilder = new TreeBuilder();
28
        $rootNode = $treeBuilder->root('open_exchange_rates');
29
        $rootNode
30
            ->children()
31
                ->scalarNode('api_id')
32
                    ->cannotBeEmpty()
33
                    ->isRequired()
34
                ->end()
35
                ->arrayNode('api_configuration')
36
                    ->addDefaultsIfNotSet()
37
                    ->children()
38
                        ->scalarNode('https')
39
                            ->defaultValue(false)
40
                        ->end()
41
                        ->scalarNode('base_currency')
42
                            ->defaultValue('USD')
43
                        ->end()
44
                    ->end()
45
            ->end();
46
47
        return $treeBuilder;
48
    }
49
}
50