Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
cbo 3
dl 0
loc 28
ccs 15
cts 15
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 22 1
1
<?php
2
3
/*
4
 * This file is part of the xAPI package.
5
 *
6
 * (c) Christian Flothmann <[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 Xabbuh\XApi\Bundle\LrsBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15
use Symfony\Component\Config\Definition\ConfigurationInterface;
16
17
/**
18
 * The bundle configuration.
19
 *
20
 * @author Christian Flothmann <[email protected]>
21
 */
22
class Configuration implements ConfigurationInterface
23
{
24
    /**
25
     * {@inheritDoc}
26
     */
27 2
    public function getConfigTreeBuilder()
28
    {
29 2
        $treeBuilder = new TreeBuilder();
30 2
        $rootNode = $treeBuilder->root('xabbuh_lrs');
31
32 2
        $supportedDrivers = array('mongodb');
33
34
        $rootNode
35 2
            ->children()
36 2
                ->scalarNode('driver')
37 2
                    ->validate()
38 2
                        ->ifNotInArray($supportedDrivers)
39 2
                        ->thenInvalid('The driver %s is not supported. Please choose on of '.json_encode($supportedDrivers))
40 2
                    ->end()
41 2
                    ->isRequired()
42 2
                    ->cannotBeEmpty()
43 2
                ->end()
44 2
            ->end()
45
        ;
46
47 2
        return $treeBuilder;
48
    }
49
}
50