Configuration::getConfigTreeBuilder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 60
Code Lines 54

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 54
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 54
nc 1
nop 0
dl 0
loc 60
ccs 54
cts 54
cp 1
crap 1
rs 9.0036
c 2
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 LAG\SmokerBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
class Configuration implements ConfigurationInterface
9
{
10 1
    public function getConfigTreeBuilder()
11
    {
12 1
        $treeBuilder = new TreeBuilder();
13 1
        $root = $treeBuilder->root('lag_smoke');
0 ignored issues
show
Deprecated Code introduced by
The function Symfony\Component\Config...der\TreeBuilder::root() has been deprecated: since Symfony 4.3, pass the root name to the constructor instead ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

13
        $root = /** @scrutinizer ignore-deprecated */ $treeBuilder->root('lag_smoke');

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
14
15
        $root
16 1
            ->children()
17 1
                ->arrayNode('routing')
18 1
                    ->addDefaultsIfNotSet()
19 1
                    ->children()
20 1
                        ->scalarNode('scheme')
21 1
                            ->defaultValue('http')
22 1
                        ->end()
23 1
                        ->scalarNode('host')
24 1
                            ->defaultValue('127.0.0.1')
25 1
                        ->end()
26 1
                        ->scalarNode('port')
27 1
                            ->defaultValue('8000')
28 1
                        ->end()
29 1
                        ->scalarNode('base_url')
30 1
                            ->defaultValue('')
31 1
                        ->end()
32 1
                    ->end()
33 1
                ->end()
34 1
                ->arrayNode('routes')
35 1
                    ->arrayPrototype()
36 1
                        ->children()
37 1
                            ->scalarNode('mapping')->end()
38 1
                            ->arrayNode('handlers')
39 1
                                ->defaultValue([
40 1
                                    'response_code' => '200',
41
                                ])
42 1
                                ->variablePrototype()->end()
43 1
                            ->end()
44 1
                        ->end()
45 1
                    ->end()
46 1
                ->end()
47 1
                ->arrayNode('mapping')
48 1
                    ->arrayPrototype()
49 1
                        ->children()
50 1
                            ->scalarNode('entity')->end()
51 1
                            ->scalarNode('pattern')->end()
52 1
                            ->scalarNode('route')->end()
53 1
                            ->scalarNode('provider')->defaultValue('doctrine')->end()
54 1
                            ->arrayNode('options')
55 1
                                ->variablePrototype()->end()
56 1
                            ->end()
57 1
                            ->arrayNode('requirements')
58 1
                                ->scalarPrototype()->end()
59 1
                            ->end()
60 1
                            ->arrayNode('excludes')
61 1
                                ->scalarPrototype()->end()
62 1
                            ->end()
63 1
                        ->end()
64 1
                    ->end()
65 1
                ->end()
66 1
            ->end()
67
        ;
68
69 1
        return $treeBuilder;
70
    }
71
}
72