Completed
Pull Request — master (#311)
by De Cramer
06:47
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 9.2
c 0
b 0
f 0
cc 1
eloc 19
nc 1
nop 0
1
<?php
2
3
4
namespace eXpansion\Framework\Core\DependencyInjection;
5
6
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
7
use Symfony\Component\Config\Definition\ConfigurationInterface;
8
9
10
/**
11
 * Class Configuration
12
 *
13
 * @package eXpansion\Framework\Core\DependencyInjection;
14
 * @author  oliver de Cramer <[email protected]>
15
 */
16
class Configuration implements ConfigurationInterface
17
{
18
19
    /**
20
     * Generates the configuration tree builder.
21
     *
22
     * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder
23
     */
24
    public function getConfigTreeBuilder()
25
    {
26
        $treeBuilder = new TreeBuilder();
27
        $treeBuilder->root('e_xpansion_core')
28
            ->children()
29
                ->arrayNode('widget_positions')
30
                    ->prototype('array') // Id of the widget.
31
                        ->prototype('array') // Title
32
                            ->prototype('array') // Game mode
33
                                ->prototype('array')->children() // Script
34
                                    ->floatNode('posX')->end()
35
                                    ->floatNode('posY')->end()
36
                                    ->variableNode('options')->end()
37
                                ->end()->end()
38
                            ->end()
39
                        ->end()
40
                    ->end()
41
                ->end()
42
            ->end();
43
44
        return $treeBuilder;
45
    }
46
}