Test Failed
Pull Request — master (#3)
by
unknown
10:08
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 0
cts 6
cp 0
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Paysera\Bundle\NormalizationBundle\DependencyInjection;
5
6
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
7
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
8
use Symfony\Component\Config\Definition\ConfigurationInterface;
9
10
class Configuration implements ConfigurationInterface
11
{
12
    public function getConfigTreeBuilder()
13
    {
14
        $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...
15
        $rootNode = $treeBuilder->root('paysera_normalization');
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...
16
17
        $children = $rootNode->children();
18
19
        $this->registerNormalizers($children->arrayNode('register_normalizers'));
20
21
        return $treeBuilder;
22
    }
23
24
    private function registerNormalizers(ArrayNodeDefinition $node)
25
    {
26
        $builder = $node->children();
27
        $builder
28
            ->arrayNode('date_time')
29
            ->children()
30
            ->scalarNode('format')
31
            ->isRequired()
32
        ;
33
    }
34
}
35