Passed
Push — master ( 70e83c...1c3e17 )
by Guilherme
01:08 queued 10s
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 59
Code Lines 54

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 54
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 54
nc 1
nop 0
dl 0
loc 59
ccs 54
cts 54
cp 1
crap 1
rs 9.0036
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace PROCERGS\LoginCidadao\NfgBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
/**
9
 * This is the class that validates and merges configuration from your app/config files
10
 *
11
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
12
 */
13
class Configuration implements ConfigurationInterface
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18 4
    public function getConfigTreeBuilder()
19
    {
20 4
        $treeBuilder = new TreeBuilder();
21 4
        $rootNode = $treeBuilder->root('procergs_nfg');
22
23
        $rootNode
24 4
            ->children()
25 4
                ->booleanNode('verify_https')
26 4
                    ->info('When false, errors such as invalid TLS certificates will be ignored')
27 4
                    ->defaultTrue()
28 4
                ->end()
29 4
                ->arrayNode('circuit_breaker')
30 4
                    ->addDefaultsIfNotSet()
31 4
                    ->children()
32 4
                        ->integerNode('max_failures')
33 4
                            ->min(1)
34 4
                            ->defaultValue(2)
35 4
                        ->end()
36 4
                        ->integerNode('reset_timeout')
37 4
                            ->min(1)
38 4
                            ->defaultValue(30)
39 4
                        ->end()
40 4
                    ->end()
41 4
                ->end()
42 4
                ->arrayNode('endpoints')
43 4
                    ->isRequired()
44 4
                    ->children()
45 4
                        ->scalarNode('wsdl')
46 4
                            ->isRequired()
47 4
                        ->end()
48 4
                        ->scalarNode('login')
49 4
                            ->isRequired()
50 4
                        ->end()
51 4
                        ->scalarNode('authorization')
52 4
                            ->isRequired()
53 4
                        ->end()
54 4
                    ->end()
55 4
                ->end()
56 4
                ->arrayNode('authentication')
57 4
                    ->isRequired()
58 4
                    ->children()
59 4
                        ->scalarNode('organization')
60 4
                            ->isRequired()
61 4
                        ->end()
62 4
                        ->scalarNode('username')
63 4
                            ->isRequired()
64 4
                        ->end()
65 4
                        ->scalarNode('password')
66 4
                            ->isRequired()
67 4
                        ->end()
68 4
                        ->scalarNode('hmac_secret')
69 4
                            ->isRequired()
70 4
                        ->end()
71 4
                    ->end()
72 4
                ->end()
73 4
            ->end()
74
        ;
75
76 4
        return $treeBuilder;
77
    }
78
}
79