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 127
Code Lines 114

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
dl 0
loc 127
rs 8.2857
c 2
b 0
f 0
cc 1
eloc 114
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 Lexik\Bundle\PayboxBundle\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
    public function getConfigTreeBuilder()
19
    {
20
        $treeBuilder = new TreeBuilder();
21
        $rootNode = $treeBuilder->root('lexik_paybox');
22
23
        $rootNode
24
            ->addDefaultsIfNotSet()
25
            ->children()
26
                ->scalarNode('public_key')->defaultValue(null)->end()
27
28
                ->arrayNode('parameters')
29
                    ->isRequired()
30
                    ->children()
31
                        ->scalarNode('production')->defaultValue(false)->end()
32
                        ->arrayNode('currencies')
33
                            ->defaultValue(array(
34
                                '036', // AUD
35
                                '124', // CAD
36
                                '756', // CHF
37
                                '826', // GBP
38
                                '840', // USD
39
                                '978', // EUR
40
                            ))
41
                            ->prototype('scalar')->end()
42
                        ->end()
43
                        ->scalarNode('site')->isRequired()->end()
44
                        ->scalarNode('rank')->defaultValue(null)->end()
45
                        ->scalarNode('rang')->defaultValue(null)->end()
46
                        ->scalarNode('login')->defaultValue(null)->end()
47
                        ->scalarNode('cle')->defaultValue(null)->end()
48
                        ->arrayNode('hmac')
49
                            ->isRequired()
50
                            ->children()
51
                                ->scalarNode('algorithm')->defaultValue('sha512')->end()
52
                                ->scalarNode('key')->isRequired()->end()
53
                                ->scalarNode('signature_name')->defaultValue('Sign')->end()
54
                            ->end()
55
                        ->end()
56
                    ->end()
57
                ->end()
58
59
                ->arrayNode('servers')
60
                    ->addDefaultsIfNotSet()
61
                    ->children()
62
63
                        ->arrayNode('system')
64
                            ->addDefaultsIfNotSet()
65
                            ->children()
66
                                ->arrayNode('primary')
67
                                    ->addDefaultsIfNotSet()
68
                                    ->children()
69
                                        ->scalarNode('protocol')->defaultValue('https')->end()
70
                                        ->scalarNode('host')->defaultValue('tpeweb.paybox.com')->end()
71
                                        ->scalarNode('system_path')->defaultValue('/cgi/MYchoix_pagepaiement.cgi')->end()
72
                                        ->scalarNode('cancellation_path')->defaultValue('/cgi-bin/ResAbon.cgi')->end()
73
                                        ->scalarNode('test_path')->defaultValue('/load.html')->end()
74
                                    ->end()
75
                                ->end()
76
                                ->arrayNode('secondary')
77
                                    ->addDefaultsIfNotSet()
78
                                    ->children()
79
                                        ->scalarNode('protocol')->defaultValue('https')->end()
80
                                        ->scalarNode('host')->defaultValue('tpeweb1.paybox.com')->end()
81
                                        ->scalarNode('system_path')->defaultValue('/cgi/MYchoix_pagepaiement.cgi')->end()
82
                                        ->scalarNode('cancellation_path')->defaultValue('/cgi-bin/ResAbon.cgi')->end()
83
                                        ->scalarNode('test_path')->defaultValue('/load.html')->end()
84
                                    ->end()
85
                                ->end()
86
                                ->arrayNode('preprod')
87
                                    ->addDefaultsIfNotSet()
88
                                    ->children()
89
                                        ->scalarNode('protocol')->defaultValue('https')->end()
90
                                        ->scalarNode('host')->defaultValue('preprod-tpeweb.paybox.com')->end()
91
                                        ->scalarNode('system_path')->defaultValue('/cgi/MYchoix_pagepaiement.cgi')->end()
92
                                        ->scalarNode('cancellation_path')->defaultValue('/cgi-bin/ResAbon.cgi')->end()
93
                                        ->scalarNode('test_path')->defaultValue('/load.html')->end()
94
                                    ->end()
95
                                ->end()
96
                            ->end()
97
                        ->end()
98
99
                        ->arrayNode('direct_plus')
100
                            ->addDefaultsIfNotSet()
101
                            ->children()
102
                                ->arrayNode('primary')
103
                                    ->addDefaultsIfNotSet()
104
                                    ->children()
105
                                        ->scalarNode('protocol')->defaultValue('https')->end()
106
                                        ->scalarNode('host')->defaultValue('ppps.paybox.com')->end()
107
                                        ->scalarNode('api_path')->defaultValue('/PPPS.php')->end()
108
                                    ->end()
109
                                ->end()
110
                                ->arrayNode('secondary')
111
                                    ->addDefaultsIfNotSet()
112
                                    ->children()
113
                                        ->scalarNode('protocol')->defaultValue('https')->end()
114
                                        ->scalarNode('host')->defaultValue('ppps1.paybox.com')->end()
115
                                        ->scalarNode('api_path')->defaultValue('/PPPS.php')->end()
116
                                    ->end()
117
                                ->end()
118
                                ->arrayNode('preprod')
119
                                    ->addDefaultsIfNotSet()
120
                                    ->children()
121
                                        ->scalarNode('protocol')->defaultValue('https')->end()
122
                                        ->scalarNode('host')->defaultValue('preprod-ppps.paybox.com')->end()
123
                                        ->scalarNode('api_path')->defaultValue('/PPPS.php')->end()
124
                                    ->end()
125
                                ->end()
126
                            ->end()
127
                        ->end()
128
129
                    ->end()
130
                ->end()
131
132
                ->scalarNode('transport')
133
                    ->defaultValue('Lexik\Bundle\PayboxBundle\Transport\CurlTransport')
134
                    ->validate()
135
                    ->ifTrue(function($v) { return !class_exists($v); })
136
                        ->thenInvalid('Invalid "transport" parameter.')
137
                    ->end()
138
                ->end()
139
140
            ->end()
141
        ;
142
143
        return $treeBuilder;
144
    }
145
}
146