These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\LeadGenerationBundle\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 | View Code Duplication | class Configuration implements ConfigurationInterface |
|
0 ignored issues
–
show
|
|||
14 | { |
||
15 | /** |
||
16 | * {@inheritdoc} |
||
17 | */ |
||
18 | 3 | public function getConfigTreeBuilder() |
|
19 | { |
||
20 | 3 | $treeBuilder = new TreeBuilder('kunstmaan_lead_generation'); |
|
21 | 3 | if (method_exists($treeBuilder, 'getRootNode')) { |
|
22 | 3 | $rootNode = $treeBuilder->getRootNode(); |
|
23 | } else { |
||
24 | // BC layer for symfony/config 4.1 and older |
||
25 | $rootNode = $treeBuilder->root('kunstmaan_lead_generation'); |
||
26 | } |
||
27 | |||
28 | $rootNode |
||
29 | 3 | ->children() |
|
30 | 3 | ->arrayNode('popup_types') |
|
31 | 3 | ->isRequired() |
|
32 | 3 | ->requiresAtLeastOneElement() |
|
33 | 3 | ->prototype('scalar')->end() |
|
34 | 3 | ->end() |
|
35 | 3 | ->booleanNode('debug') |
|
36 | 3 | ->defaultFalse() |
|
37 | 3 | ->end() |
|
38 | 3 | ->end(); |
|
39 | |||
40 | 3 | return $treeBuilder; |
|
41 | } |
||
42 | } |
||
43 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.