Configuration::getConfigTreeBuilder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 6
cts 6
cp 1
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
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 6
    public function getConfigTreeBuilder()
13
    {
14 6
        $treeBuilder = new TreeBuilder();
15 6
        $rootNode = $treeBuilder->root('paysera_normalization');
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...
16
17 6
        $children = $rootNode->children();
18
19 6
        $this->registerNormalizers($children->arrayNode('register_normalizers'));
20
21 6
        return $treeBuilder;
22
    }
23
24 6
    private function registerNormalizers(ArrayNodeDefinition $node)
25
    {
26 6
        $builder = $node->children();
27
        $builder
28 6
            ->arrayNode('date_time')
29 6
            ->children()
30 6
            ->scalarNode('format')
31 6
            ->isRequired()
32
        ;
33 6
    }
34
}
35