Configuration::getConfigTreeBuilder()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 71

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 68
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 71
ccs 68
cts 68
cp 1
rs 8.6327
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
namespace GoetasWebservices\SoapServices\SoapClient\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 2
    public function getConfigTreeBuilder()
11
    {
12 2
        $treeBuilder = new TreeBuilder();
13 2
        $rootNode = $treeBuilder->root('soap_client');
0 ignored issues
show
Deprecated Code introduced by
The method Symfony\Component\Config...der\TreeBuilder::root() has been deprecated with message: since Symfony 4.3, pass the root name to the constructor instead

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

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

Loading history...
14
        $rootNode
15 2
            ->children()
16 2
            ->arrayNode('alternative_endpoints')->fixXmlConfig('alternative_endpoint')
17 2
            ->prototype('array')
18 2
            ->prototype('scalar')
19 2
            ->end()
20 2
            ->end()
21 2
            ->end()
22 2
            ->scalarNode('unwrap_returns')
23 2
            ->defaultValue(false)
24 2
            ->end()
25 2
            ->scalarNode('naming_strategy')
26 2
            ->defaultValue('short')
27 2
            ->cannotBeEmpty()
28 2
            ->end()
29 2
            ->scalarNode('path_generator')
30 2
            ->defaultValue('psr4')
31 2
            ->cannotBeEmpty()
32 2
            ->end()
33 2
            ->arrayNode('namespaces')->fixXmlConfig('namespace')
34 2
            ->cannotBeEmpty()->isRequired()
35 2
            ->requiresAtLeastOneElement()
36 2
            ->prototype('scalar')
37 2
            ->end()
38 2
            ->end()
39 2
            ->arrayNode('known_locations')->fixXmlConfig('known_location')
40 2
            ->prototype('scalar')
41 2
            ->end()
42 2
            ->end()
43 2
            ->arrayNode('destinations_php')->fixXmlConfig('destination_php')
44 2
            ->cannotBeEmpty()->isRequired()
45 2
            ->requiresAtLeastOneElement()
46 2
            ->prototype('scalar')
47 2
            ->end()
48 2
            ->end()
49 2
            ->arrayNode('destinations_jms')->fixXmlConfig('destination_jms')
50 2
            ->cannotBeEmpty()->isRequired()
51 2
            ->requiresAtLeastOneElement()
52 2
            ->prototype('scalar')
53 2
            ->end()
54 2
            ->end()
55 2
            ->arrayNode('aliases')->fixXmlConfig('alias')
56 2
            ->prototype('array')
57 2
            ->prototype('scalar')
58 2
            ->end()
59 2
            ->end()
60 2
            ->end()
61 2
            ->scalarNode('headers')
62 2
            ->defaultValue('\\SoapEnvelope\\Headers')
63 2
            ->cannotBeEmpty()
64 2
            ->end()
65 2
            ->scalarNode('parts')
66 2
            ->defaultValue('\\SoapEnvelope\\Parts')
67 2
            ->cannotBeEmpty()
68 2
            ->end()
69 2
            ->scalarNode('messages')
70 2
            ->defaultValue('\\SoapEnvelope\\Messages')
71 2
            ->cannotBeEmpty()
72 2
            ->end()
73 2
            ->arrayNode('metadata')->fixXmlConfig('metadata')
74 2
            ->cannotBeEmpty()->isRequired()
75 2
            ->requiresAtLeastOneElement()
76 2
            ->prototype('scalar')->end()
77 2
            ->end()
78 2
            ->end();
79 2
        return $treeBuilder;
80
    }
81
}
82