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.
Completed
Pull Request — master (#158)
by Bernardo Vieira da
12:24
created

Configuration::getConfigTreeBuilder()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 85

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 76
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 85
ccs 76
cts 76
cp 1
rs 8.3272
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1

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
/**
4
 * Gearman Bundle for Symfony2
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 *
9
 * Feel free to edit as you please, and have fun.
10
 *
11
 * @author Marc Morera <[email protected]>
12
 */
13
14
namespace Mmoreram\GearmanBundle\DependencyInjection;
15
16
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
17
use Symfony\Component\Config\Definition\ConfigurationInterface;
18
19
/**
20
 * This is the class that validates and merges configuration from your
21
 * app/config files
22
 *
23
 * @since 2.3.1
24
 */
25
class Configuration implements ConfigurationInterface
26
{
27
    /**
28
     * Generates the configuration tree builder.
29
     *
30
     * @return TreeBuilder The tree builder
31
     */
32 1
    public function getConfigTreeBuilder()
33
    {
34 1
        $treeBuilder = new TreeBuilder();
35 1
        $rootNode = $treeBuilder->root('gearman');
36
37
        $rootNode
38 1
            ->children()
39 1
                ->arrayNode('bundles')
40 1
                    ->prototype('array')
41 1
                        ->children()
42 1
                            ->scalarNode('name')
43 1
                                ->isRequired()
44 1
                                ->cannotBeEmpty()
45 1
                            ->end()
46 1
                            ->booleanNode('active')
47 1
                                ->defaultFalse()
48 1
                            ->end()
49 1
                            ->arrayNode('include')
50 1
                                ->prototype('scalar')->end()
51 1
                            ->end()
52 1
                            ->arrayNode('ignore')
53 1
                                ->prototype('scalar')->end()
54 1
                            ->end()
55 1
                        ->end()
56 1
                    ->end()
57 1
                ->end()
58 1
                ->arrayNode('resources')
59 1
                    ->scalarPrototype()->end()
60 1
                ->end()
61 1
                ->arrayNode('servers')
62 1
                    ->performNoDeepMerging()
63 1
                    ->defaultValue(array(
64 1
                        'localhost' =>  array(
65
                            'host'  =>  '127.0.0.1',
66
                            'port'  =>  '4730',
67
                        ),
68
                    ))
69 1
                    ->prototype('array')
70 1
                        ->children()
71 1
                            ->scalarNode('host')
72 1
                                ->isRequired()
73 1
                                ->cannotBeEmpty()
74 1
                            ->end()
75 1
                            ->integerNode('port')
76 1
                                ->defaultValue('4730')
77 1
                            ->end()
78 1
                        ->end()
79 1
                    ->end()
80 1
                ->end()
81 1
                ->arrayNode('defaults')
82 1
                    ->addDefaultsIfNotSet()
83 1
                    ->children()
84 1
                        ->integerNode('iterations')
85 1
                            ->min(0)
86 1
                            ->defaultValue(0)
87 1
                        ->end()
88 1
                        ->scalarNode('method')
89 1
                            ->defaultValue('doNormal')
90 1
                        ->end()
91 1
                        ->booleanNode('callbacks')
92 1
                            ->defaultTrue()
93 1
                        ->end()
94 1
                        ->scalarNode('job_prefix')
95 1
                            ->defaultNull()
96 1
                        ->end()
97 1
                        ->booleanNode('generate_unique_key')
98 1
                            ->defaultTrue()
99 1
                        ->end()
100 1
                        ->booleanNode('workers_name_prepend_namespace')
101 1
                            ->defaultTrue()
102 1
                        ->end()
103 1
                        ->integerNode('minimum_execution_time')
104 1
                            ->min(0)
105 1
                            ->defaultValue(0)
106 1
                        ->end()
107 1
                        ->integerNode('timeout')
108 1
                            ->min(0)
109 1
                            ->defaultValue(0)
110 1
                        ->end()
111 1
                    ->end()
112 1
                ->end()
113 1
            ->end();
114
115 1
        return $treeBuilder;
116
    }
117
}
118