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 111
Code Lines 105

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 111
rs 8.2857
c 0
b 0
f 0
cc 1
eloc 105
nc 1
nop 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 Nimble\ElasticBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
/**
9
 * Configures the bundle.
10
 */
11
class Configuration implements ConfigurationInterface
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16
    public function getConfigTreeBuilder()
17
    {
18
        $treeBuilder = new TreeBuilder();
19
20
        $rootNode = $treeBuilder->root('nimble_elastic');
21
22
        $rootNode
23
            ->children()
24
                ->scalarNode('default_client')
25
                    ->defaultValue('default')
26
                ->end()
27
                ->arrayNode('clients')
28
                    ->isRequired()
29
                    ->performNoDeepMerging()
30
                    ->prototype('array')
31
                        ->children()
32
                            ->arrayNode('hosts')
33
                                ->requiresAtLeastOneElement()
34
                                ->isRequired()
35
                                ->prototype('scalar')->end()
36
                            ->end()
37
                            ->arrayNode('logging')
38
                                ->addDefaultsIfNotSet()
39
                                ->children()
40
                                    ->booleanNode('enabled')
41
                                        ->defaultFalse()
42
                                    ->end()
43
                                    ->scalarNode('service')
44
                                        ->defaultValue('logger')
45
                                    ->end()
46
                                ->end()
47
                            ->end()
48
                        ->end()
49
                    ->end()
50
                ->end()
51
                ->arrayNode('synchronization_listeners')
52
                    ->addDefaultsIfNotSet()
53
                    ->children()
54
                        ->arrayNode('doctrine_orm')
55
                            ->addDefaultsIfNotSet()
56
                            ->children()
57
                                ->booleanNode('enabled')->defaultFalse()->end()
58
                                ->scalarNode('connection')->defaultValue('default')->end()
59
                            ->end()
60
                        ->end()
61
                    ->end()
62
                ->end()
63
                ->arrayNode('indexes')
64
                    ->requiresAtLeastOneElement()
65
                    ->isRequired()
66
                    ->performNoDeepMerging()
67
                    ->prototype('array')
68
                        ->children()
69
                            ->scalarNode('client')
70
                                ->defaultNull()
71
                            ->end()
72
                            ->scalarNode('name')
73
                                ->defaultNull()
74
                            ->end()
75
                            ->variableNode('settings')
76
                                ->defaultValue([])
77
                            ->end()
78
                            ->arrayNode('types')
79
                                ->requiresAtLeastOneElement()
80
                                ->isRequired()
81
                                ->prototype('array')
82
                                    ->children()
83
                                        ->arrayNode('fetcher')
84
                                            ->children()
85
                                                ->scalarNode('service')->end()
86
                                                ->scalarNode('doctrine_orm_entity')->end()
87
                                            ->end()
88
                                        ->end()
89
                                        ->arrayNode('entities')
90
                                            ->prototype('array')
91
                                                ->children()
92
                                                    ->scalarNode('transformer_service')
93
                                                        ->defaultNull()
94
                                                    ->end()
95
                                                    ->scalarNode('logger_service')
96
                                                        ->defaultNull()
97
                                                    ->end()
98
                                                    ->enumNode('on_create')
99
                                                        ->values(['create', 'update', 'delete', false])
100
                                                        ->defaultValue('create')
101
                                                    ->end()
102
                                                    ->enumNode('on_update')
103
                                                        ->values(['create', 'update', 'delete', false])
104
                                                        ->defaultValue('update')
105
                                                    ->end()
106
                                                    ->enumNode('on_delete')
107
                                                        ->values(['create', 'update', 'delete', false])
108
                                                        ->defaultValue('delete')
109
                                                    ->end()
110
                                                ->end()
111
                                            ->end()
112
                                        ->end()
113
                                        ->variableNode('mappings')
114
                                            ->defaultValue([])
115
                                        ->end()
116
                                    ->end()
117
                                ->end()
118
                            ->end()
119
                        ->end()
120
                    ->end()
121
                ->end()
122
            ->end()
123
        ;
124
125
        return $treeBuilder;
126
    }
127
}
128