Completed
Push — master ( c091a3...52a46f )
by Petrică
02:24
created

ConfigDefinition::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 17
ccs 0
cts 16
cp 0
rs 9.4285
cc 1
eloc 14
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Petrica
5
 * Date: 3/26/2016
6
 * Time: 1:25
7
 */
8
namespace Petrica\StatsdSystem\Config\Definition;
9
10
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
11
use Symfony\Component\Config\Definition\ConfigurationInterface;
12
13
/**
14
 * Class ConfigDefinition
15
 * @package Petrica\StatsdSystem\Config\Definition
16
 */
17
class ConfigDefinition implements ConfigurationInterface
18
{
19
    /**
20
     * Provides configuration mapping
21
     *
22
     * @return TreeBuilder
23
     */
24
    public function getConfigTreeBuilder()
25
    {
26
        $treeBuilder = new TreeBuilder();
27
        $rootNode = $treeBuilder->root('gauges');
28
        $rootNode
29
            ->useAttributeAsKey('path')
30
            ->prototype('array')
31
            ->children()
32
                ->scalarNode('class')
33
                    ->isRequired()
34
                    ->cannotBeEmpty()
35
                ->end()
36
                ->variableNode('arguments')->end()
37
            ->end();
38
39
        return $treeBuilder;
40
    }
41
}
42