Configuration::getConfigTreeBuilder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 36
Code Lines 31

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 31
nc 1
nop 0
dl 0
loc 36
rs 9.424
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gewebe\SyliusVATPlugin\DependencyInjection;
6
7
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
8
use Symfony\Component\Config\Definition\ConfigurationInterface;
9
10
final class Configuration implements ConfigurationInterface
11
{
12
    public function getConfigTreeBuilder(): TreeBuilder
13
    {
14
        $treeBuilder = new TreeBuilder('gewebe_sylius_vat');
15
16
        $treeBuilder->getRootNode()
17
            ->children()
18
                ->arrayNode('order')
19
                    ->children()
20
                        ->booleanNode('recalculate')->defaultValue(true)->end()
21
                    ->end()
22
                ->end() // order
23
                ->arrayNode('validate')
24
                    ->children()
25
                        ->booleanNode('is_active')->defaultValue(true)->end()
26
                        ->booleanNode('country')->defaultValue(true)->end()
27
                        ->booleanNode('existence')->defaultValue(true)->end()
28
                    ->end()
29
                ->end() // validation
30
                ->arrayNode('required')
31
                    ->children()
32
                        ->booleanNode('default')->defaultValue(true)->end()
33
                        ->booleanNode('company')->defaultValue(true)->end()
34
                        ->arrayNode('countries')
35
                            ->scalarPrototype()->end()
36
                        ->end()
37
                    ->end()
38
                ->end() // required
39
                ->arrayNode('revalidate')
40
                    ->children()
41
                        ->booleanNode('on_login')->defaultValue(true)->end()
42
                        ->integerNode('expiration_days')->defaultValue(30)->end()
43
                    ->end()
44
                ->end() // revalidate
45
        ;
46
47
        return $treeBuilder;
48
    }
49
}
50