Completed
Push — master ( 52a46f...98e19a )
by Petrică
02:29
created

ConfigDefinition::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 17
ccs 14
cts 14
cp 1
rs 9.4285
cc 1
eloc 14
nc 1
nop 0
crap 1
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 1
    public function getConfigTreeBuilder()
25
    {
26 1
        $treeBuilder = new TreeBuilder();
27 1
        $rootNode = $treeBuilder->root('gauges');
28
        $rootNode
29 1
            ->useAttributeAsKey('path')
30 1
            ->prototype('array')
31 1
            ->children()
32 1
                ->scalarNode('class')
33 1
                    ->isRequired()
34 1
                    ->cannotBeEmpty()
35 1
                ->end()
36 1
                ->variableNode('arguments')->end()
37 1
            ->end();
38
39 1
        return $treeBuilder;
40 1
    }
41
}
42