Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 73
dl 0
loc 79
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
B getConfigTreeBuilder() 0 77 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Zikula package.
7
 *
8
 * Copyright Zikula - https://ziku.la/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Zikula\LegalBundle\DependencyInjection;
15
16
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
17
use Symfony\Component\Config\Definition\ConfigurationInterface;
18
19
class Configuration implements ConfigurationInterface
20
{
21
    public function getConfigTreeBuilder(): TreeBuilder
22
    {
23
        $treeBuilder = new TreeBuilder('zikula_legal');
24
25
        $treeBuilder->getRootNode()
26
            ->fixXmlConfig('policy')
0 ignored issues
show
Bug introduced by
The method fixXmlConfig() does not exist on Symfony\Component\Config...\Builder\NodeDefinition. It seems like you code against a sub-type of Symfony\Component\Config...\Builder\NodeDefinition such as Symfony\Component\Config...der\ArrayNodeDefinition. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

26
            ->/** @scrutinizer ignore-call */ fixXmlConfig('policy')
Loading history...
27
            ->children()
28
                ->arrayNode('policies')
29
                    ->info('Configure the available policies.')
30
                    ->addDefaultsIfNotSet()
31
                    ->children()
32
                        ->arrayNode('legal_notice')
33
                            ->info('Legal notice.')
34
                            ->canBeDisabled()
35
                            ->children()
36
                                ->scalarNode('custom_url')
37
                                    ->defaultNull()
38
                                ->end()
39
                            ->end()
0 ignored issues
show
Bug introduced by
The method end() does not exist on Symfony\Component\Config...der\NodeParentInterface. It seems like you code against a sub-type of said class. However, the method does not exist in Symfony\Component\Config...ion\Builder\TreeBuilder. Are you sure you never get one of those? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

39
                            ->/** @scrutinizer ignore-call */ end()
Loading history...
40
                        ->end()
41
                        ->arrayNode('privacy_policy')
42
                            ->info('Privacy policy.')
43
                            ->canBeDisabled()
44
                            ->children()
45
                                ->scalarNode('custom_url')
46
                                    ->defaultNull()
47
                                ->end()
48
                            ->end()
49
                        ->end()
50
                        ->arrayNode('terms_of_use')
51
                            ->info('Terms of use.')
52
                            ->canBeEnabled()
53
                            ->children()
54
                                ->scalarNode('custom_url')
55
                                    ->defaultNull()
56
                                ->end()
57
                            ->end()
58
                        ->end()
59
                        ->arrayNode('trade_conditions')
60
                            ->info('General terms and conditions of trade.')
61
                            ->canBeEnabled()
62
                            ->children()
63
                                ->scalarNode('custom_url')
64
                                    ->defaultNull()
65
                                ->end()
66
                            ->end()
67
                        ->end()
68
                        ->arrayNode('cancellation_right_policy')
69
                            ->info('Cancellation right policy.')
70
                            ->canBeEnabled()
71
                            ->children()
72
                                ->scalarNode('custom_url')
73
                                    ->defaultNull()
74
                                ->end()
75
                            ->end()
76
                        ->end()
77
                        ->arrayNode('accessibility')
78
                            ->info('Accessibility statement.')
79
                            ->canBeEnabled()
80
                            ->children()
81
                                ->scalarNode('custom_url')
82
                                    ->defaultNull()
83
                                ->end()
84
                            ->end()
85
                        ->end()
86
                    ->end()
87
                ->end()
88
                ->integerNode('minimum_age')
89
                    ->info('Minimum age permitted to register (0 disables the age check).')
90
                    ->defaultValue(13)
91
                    ->min(0)
92
                    ->max(99)
93
                ->end()
94
            ->end()
95
        ;
96
97
        return $treeBuilder;
98
    }
99
}
100