Completed
Push — master ( 355f41...200862 )
by Mickael
06:25
created

Configuration   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 90
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 90
ccs 73
cts 73
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B getConfigTreeBuilder() 0 82 1
1
<?php
2
3
/**
4
 * Gearman Bundle for Symfony2 / Symfony3
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 Mkk\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
class Configuration implements ConfigurationInterface
24
{
25
    /**
26
     * Generates the configuration tree builder.
27
     *
28
     * @return TreeBuilder The tree builder
29
     */
30 1
    public function getConfigTreeBuilder()
31
    {
32 1
        $treeBuilder = new TreeBuilder();
33 1
        $rootNode = $treeBuilder->root('gearman');
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
34
35
        $rootNode
36 1
            ->children()
37 1
                ->arrayNode('bundles')
38 1
                    ->prototype('array')
39 1
                        ->children()
40 1
                            ->scalarNode('name')
41 1
                                ->isRequired()
42 1
                                ->cannotBeEmpty()
43 1
                            ->end()
44 1
                            ->booleanNode('active')
45 1
                                ->defaultFalse()
46 1
                            ->end()
47 1
                            ->arrayNode('include')
48 1
                                ->prototype('scalar')->end()
49 1
                            ->end()
50 1
                            ->arrayNode('ignore')
51 1
                                ->prototype('scalar')->end()
52 1
                            ->end()
53 1
                        ->end()
54 1
                    ->end()
55 1
                ->end()
56 1
                ->arrayNode('servers')
57 1
                    ->performNoDeepMerging()
58 1
                    ->defaultValue(array(
59
                        'localhost' =>  array(
60
                            'host'  =>  '127.0.0.1',
61
                            'port'  =>  '4730',
62 1
                        ),
63
                    ))
64 1
                    ->prototype('array')
65 1
                        ->children()
66 1
                            ->scalarNode('host')
67 1
                                ->isRequired()
68 1
                                ->cannotBeEmpty()
69 1
                            ->end()
70 1
                            ->integerNode('port')
71 1
                                ->defaultValue('4730')
72 1
                            ->end()
73 1
                        ->end()
74 1
                    ->end()
75 1
                ->end()
76 1
                ->arrayNode('defaults')
77 1
                    ->addDefaultsIfNotSet()
78 1
                    ->children()
79 1
                        ->integerNode('iterations')
80 1
                            ->min(0)
81 1
                            ->defaultValue(0)
82 1
                        ->end()
83 1
                        ->scalarNode('method')
84 1
                            ->defaultValue('doNormal')
85 1
                        ->end()
86 1
                        ->booleanNode('callbacks')
87 1
                            ->defaultTrue()
88 1
                        ->end()
89 1
                        ->scalarNode('job_prefix')
90 1
                            ->defaultNull()
91 1
                        ->end()
92 1
                        ->booleanNode('generate_unique_key')
93 1
                            ->defaultTrue()
94 1
                        ->end()
95 1
                        ->booleanNode('workers_name_prepend_namespace')
96 1
                            ->defaultTrue()
97 1
                        ->end()
98 1
                        ->integerNode('minimum_execution_time')
99 1
                            ->min(0)
100 1
                            ->defaultValue(0)
101 1
                        ->end()
102 1
                        ->integerNode('timeout')
103 1
                            ->min(0)
104 1
                            ->defaultValue(0)
105 1
                        ->end()
106 1
                    ->end()
107 1
                ->end()
108 1
            ->end();
109
110 1
        return $treeBuilder;
111
    }
112
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
113