GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Configuration::getConfigTreeBuilder()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 31
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 31
rs 8.8571
cc 1
eloc 20
nc 1
nop 0
1
<?php
2
3
namespace Akeneo\Bundle\MeasureBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
/**
9
 * Measure configuration
10
 *
11
 * @author    Nicolas Dupont <[email protected]>
12
 * @copyright 2012 Akeneo SAS (http://www.akeneo.com)
13
 * @license   http://opensource.org/licenses/MIT MIT
14
 */
15
class Configuration implements ConfigurationInterface
16
{
17
    /**
18
     * {@inheritDoc}
19
     */
20
    public function getConfigTreeBuilder()
21
    {
22
        $treeBuilder = new TreeBuilder();
23
        $rootNode = $treeBuilder->root('akeneo_measure');
24
25
        $rootNode->children()
26
            ->arrayNode('measures_config')
27
            ->prototype('array')
28
            ->children()
29
30
                // standard unit (used as reference for conversion)
31
                ->scalarNode('standard')
32
                ->isRequired()
33
                ->end()
34
35
                // units of this group
36
                ->arrayNode('units')
37
                ->prototype('array')
38
                ->children()
39
40
                    ->append($this->addConvertNode())
41
42
                    ->scalarNode('symbol')
43
                    ->isRequired()
44
                    ->end()
45
                ->end()
46
47
            ->end();
48
49
        return $treeBuilder;
50
    }
51
52
    /**
53
     * Create a node definition for operations (could be extended to define new operations)
54
     * @return \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition|
55
     *         \Symfony\Component\Config\Definition\Builder\NodeDefinition
56
     */
57
    protected function addConvertNode()
58
    {
59
        $treeBuilder = new TreeBuilder();
60
        $node = $treeBuilder->root('convert');
61
62
        $node->requiresAtLeastOneElement()
63
            ->prototype('array')
64
                ->children()
65
66
                    ->scalarNode('add')
67
                    ->cannotBeEmpty()
68
                    ->end()
69
70
                    ->scalarNode('sub')
71
                    ->cannotBeEmpty()
72
                    ->end()
73
74
                    ->scalarNode('mul')
75
                    ->cannotBeEmpty()
76
                    ->end()
77
78
                    ->scalarNode('div')
79
                    ->cannotBeEmpty()
80
                    ->end()
81
82
                ->end()
83
            ->end();
84
85
        return $node;
86
    }
87
}
88