Completed
Pull Request — master (#2786)
by
unknown
13:16 queued 07:30
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 25

Duplication

Lines 25
Ratio 100 %

Code Coverage

Tests 12
CRAP Score 2.0017

Importance

Changes 0
Metric Value
dl 25
loc 25
ccs 12
cts 13
cp 0.9231
rs 9.52
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2.0017
1
<?php
2
3
namespace Kunstmaan\FormBundle\DependencyInjection;
4
5
use Kunstmaan\MediaBundle\Utils\SymfonyVersion;
6
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
7
use Symfony\Component\Config\Definition\ConfigurationInterface;
8
9
/**
10
 * This is the class that validates and merges configuration from your app/config files
11
 *
12
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
13
 */
14 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...
15
{
16
    /**
17
     * Generates the configuration tree builder.
18
     *
19
     * @return TreeBuilder The tree builder
20
     */
21 2
    public function getConfigTreeBuilder()
22
    {
23 2
        $treeBuilder = new TreeBuilder('kunstmaan_form');
24 2
        if (method_exists($treeBuilder, 'getRootNode')) {
25 2
            $rootNode = $treeBuilder->getRootNode();
26
        } else {
27
            // BC layer for symfony/config 4.1 and older
28
            $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...
29
        }
30
31
        $rootNode
32 2
            ->children()
33 2
                ->booleanNode('deletable_formsubmissions')->defaultFalse()->end()
34 2
                ->scalarNode('web_root')
35 2
                    ->defaultValue(SymfonyVersion::getRootWebPath())
36 2
                    ->cannotBeEmpty()
37 2
                ->end()
38 2
            ->end()
39
        ;
40
41
        // Here you should define the parameters that are allowed to
42
        // configure your bundle. See the documentation linked above for
43
        // more information on that topic.
44 2
        return $treeBuilder;
45
    }
46
}
47