Configuration   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 88.89%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 29
loc 29
ccs 8
cts 9
cp 0.8889
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 21 21 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Kunstmaan\FormBundle\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
Duplication introduced by
This class seems to be duplicated in your project.

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.

Loading history...
14
{
15
    /**
16
     * Generates the configuration tree builder.
17
     *
18
     * @return TreeBuilder The tree builder
19
     */
20 2
    public function getConfigTreeBuilder()
21
    {
22 2
        $treeBuilder = new TreeBuilder('kunstmaan_form');
23 2
        if (method_exists($treeBuilder, 'getRootNode')) {
24 2
            $rootNode = $treeBuilder->getRootNode();
25
        } else {
26
            // BC layer for symfony/config 4.1 and older
27
            $rootNode = $treeBuilder->root('kunstmaan_form');
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...
28
        }
29
30
        $rootNode
31 2
            ->children()
32 2
                ->booleanNode('deletable_formsubmissions')->defaultFalse()->end()
33 2
            ->end()
34
        ;
35
36
        // Here you should define the parameters that are allowed to
37
        // configure your bundle. See the documentation linked above for
38
        // more information on that topic.
39 2
        return $treeBuilder;
40
    }
41
}
42