Completed
Branch unittests (5b5894)
by Ruben
02:30
created

Configuration   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 38
ccs 19
cts 19
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B getConfigTreeBuilder() 0 25 1
1
<?php
2
3
namespace MovingImage\Bundle\VMProApiBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
/**
9
 * Class Configuration.
10
 *
11
 * @author Ruben Knol <[email protected]>
12
 */
13
class Configuration implements ConfigurationInterface
14
{
15
    /**
16
     * @const Which API base URL to use by default.
17
     */
18
    const DEFAULT_API_BASE_URL = 'https://api.video-cdn.net/v1/vms/';
19
20
    /**
21
     * Build the configuration structure for this bundle.
22
     *
23
     * @return TreeBuilder
24
     */
25 12
    public function getConfigTreeBuilder()
26
    {
27 12
        $treeBuilder = new TreeBuilder();
28 12
        $rootNode = $treeBuilder->root('vm_pro_api');
29
30
        $rootNode
31 12
            ->children()
32 12
                ->scalarNode('base_url')
33 12
                    ->defaultValue(self::DEFAULT_API_BASE_URL)
34 12
                ->end()
35 12
                ->integerNode('default_vm_id')
36 12
                    ->defaultValue(0)
37 12
                ->end()
38 12
                ->arrayNode('credentials')
39 12
                    ->isRequired()
40 12
                    ->children()
41 12
                        ->scalarNode('username')->isRequired()->end()
42 12
                        ->scalarNode('password')->isRequired()->end()
43 12
                    ->end()
44 12
                ->end()
45 12
            ->end()
46
        ;
47
48 12
        return $treeBuilder;
49
    }
50
}
51