Passed
Push — master ( 130df2...007dfb )
by Alexis
10:23
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 39

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 28
CRAP Score 2.0011

Importance

Changes 0
Metric Value
dl 0
loc 39
ccs 28
cts 30
cp 0.9333
rs 9.296
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2.0011
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Liip/FunctionalTestBundle
7
 *
8
 * (c) Lukas Kahwe Smith <[email protected]>
9
 *
10
 * This source file is subject to the MIT license that is bundled
11
 * with this source code in the file LICENSE.
12
 */
13
14
namespace Liip\FunctionalTestBundle\DependencyInjection;
15
16
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
17
use Symfony\Component\Config\Definition\ConfigurationInterface;
18
19
/**
20
 * This class contains the configuration information for the bundle.
21
 */
22
class Configuration implements ConfigurationInterface
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27 4
    public function getConfigTreeBuilder(): TreeBuilder
28
    {
29 4
        if (method_exists(TreeBuilder::class, 'getRootNode')) {
30 4
            $treeBuilder = new TreeBuilder('liip_functional_test');
31 4
            $rootNode = $treeBuilder->getRootNode();
32
        } else {
33
            // BC layer for symfony/config 4.1 and older
34
            $treeBuilder = new TreeBuilder();
0 ignored issues
show
Bug introduced by
The call to TreeBuilder::__construct() misses a required argument $name.

This check looks for function calls that miss required arguments.

Loading history...
35
            $rootNode = $treeBuilder->root('liip_functional_test', 'array');
0 ignored issues
show
Bug introduced by
The method root() does not seem to exist on object<Symfony\Component...on\Builder\TreeBuilder>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
36
        }
37
38
        $rootNode
39 4
            ->children()
40 4
                ->scalarNode('command_verbosity')->defaultValue('normal')->end()
41 4
                ->booleanNode('command_decoration')->defaultTrue()->end()
42 4
                ->arrayNode('query')
43 4
                    ->addDefaultsIfNotSet()
44 4
                    ->children()
45 4
                        ->scalarNode('max_query_count')
46 4
                            ->defaultNull()
47 4
                        ->end()
48 4
                    ->end()
49 4
                ->end()
50 4
                ->arrayNode('authentication')
51 4
                    ->addDefaultsIfNotSet()
52 4
                    ->children()
53 4
                        ->scalarNode('username')
54 4
                            ->defaultValue('')
55 4
                        ->end()
56 4
                        ->scalarNode('password')
57 4
                            ->defaultValue('')
58 4
                        ->end()
59 4
                    ->end()
60 4
                ->end()
61 4
            ->end()
62
        ;
63
64 4
        return $treeBuilder;
65
    }
66
}
67