Completed
Push — master ( 3081d8...0e5b16 )
by Ruud
43:38 queued 29:10
created

Configuration   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 61
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B getConfigTreeBuilder() 0 55 2
1
<?php
2
3
namespace Kunstmaan\MultiDomainBundle\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('kunstmaan_multi_domain');
21
        if (method_exists($treeBuilder, 'getRootNode')) {
22
            $rootNode = $treeBuilder->getRootNode();
23
        } else {
24
            // BC layer for symfony/config 4.1 and older
25
            $rootNode = $treeBuilder->root('kunstmaan_multi_domain');
26
        }
27
28
        $rootNode
29
            ->children()
30
                ->arrayNode('hosts')
31
                    ->isRequired()
32
                    ->requiresAtLeastOneElement()
33
                    // ->useAttributeAsKey('host')
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
34
                    ->prototype('array')
35
                        ->children()
36
                            ->scalarNode('host')
37
                                ->isRequired()
38
                            ->end()
39
                            ->scalarNode('protocol')
40
                                ->defaultValue('http')
41
                            ->end()
42
                            ->arrayNode('aliases')
43
                                ->prototype('scalar')->end()
44
                            ->end()
45
                            ->scalarNode('type')
46
                                ->defaultValue('single_lang')
47
                            ->end()
48
                            ->scalarNode('root')
49
                                ->defaultValue('homepage')
50
                            ->end()
51
                            ->variableNode('extra')
52
                            ->end()
53
                            ->scalarNode('default_locale')
54
                                ->isRequired()
55
                            ->end()
56
                            ->arrayNode('locales')
57
                                ->isRequired()
58
                                ->requiresAtLeastOneElement()
59
                                ->prototype('array')
60
                                    ->children()
61
                                        ->scalarNode('uri_locale')->isRequired()->end()
62
                                        ->scalarNode('locale')->isRequired()->end()
63
                                        ->variableNode('extra')->end()
64
                                    ->end()
65
                                ->end()
66
                            ->end()
67
                        ->end()
68
                ->end()
69
            ->end();
70
71
        return $treeBuilder;
72
    }
73
}
74