Passed
Push — v2 ( 9b853e...868892 )
by Daniel
04:58
created

Configuration   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 61
dl 0
loc 65
ccs 0
cts 60
cp 0
rs 10
c 2
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
B getConfigTreeBuilder() 0 63 1
1
<?php
2
3
/*
4
 * This file is part of the Silverback API Component Bundle Project
5
 *
6
 * (c) Daniel West <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Silverback\ApiComponentBundle\DependencyInjection;
15
16
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
17
use Symfony\Component\Config\Definition\ConfigurationInterface;
18
19
/**
20
 * @author Daniel West <[email protected]>
21
 */
22
class Configuration implements ConfigurationInterface
23
{
24
    public function getConfigTreeBuilder(): TreeBuilder
25
    {
26
        $treeBuilder = new TreeBuilder('silverback_api_component');
27
        $rootNode = $treeBuilder->getRootNode();
28
        $rootNode
29
            ->children()
30
                ->scalarNode('website_name')->isRequired()->end()
31
                ->scalarNode('table_prefix')->defaultValue('_acb_')->end()
32
                ->arrayNode('security')
33
                    ->addDefaultsIfNotSet()
34
                    ->children()
35
                        ->arrayNode('tokens')
36
                            ->prototype('scalar')->end()
37
                        ->end()
38
                    ->end()
39
                ->end()
40
                ->arrayNode('enabled_components')
41
                    ->addDefaultsIfNotSet()
42
                    ->children()
43
                        ->booleanNode('form')->defaultValue(true)->end()
44
                        ->booleanNode('collection')->defaultValue(true)->end()
45
                    ->end()
46
                ->end()
47
                ->arrayNode('user')
48
                    ->addDefaultsIfNotSet()
49
                    ->children()
50
                        ->scalarNode('class_name')->isRequired()->end()
51
                        ->arrayNode('email_verification')
52
                            ->addDefaultsIfNotSet()
53
                            ->children()
54
                                ->booleanNode('default')->isRequired()->end()
55
                                ->booleanNode('verify_on_register')->isRequired()->end()
56
                                ->booleanNode('deny_unverified_login')->isRequired()->end()
57
                            ->end()
58
                        ->end()
59
                        ->arrayNode('change_email_address')
60
                            ->addDefaultsIfNotSet()
61
                            ->children()
62
                                ->scalarNode('default_verify_path')->isRequired()->end()
63
                            ->end()
64
                        ->end()
65
                        ->arrayNode('password_reset')
66
                            ->addDefaultsIfNotSet()
67
                            ->children()
68
                                ->scalarNode('default_reset_path')->isRequired()->end()
69
                                ->integerNode('repeat_ttl_seconds')->defaultValue(8600)->end()
70
                                ->integerNode('request_timeout_seconds')->defaultValue(3600)->end()
71
                            ->end()
72
                        ->end()
73
                        ->arrayNode('emails')
74
                            ->addDefaultsIfNotSet()
75
                            ->children()
76
                                ->booleanNode('user_welcome')->defaultValue(true)->end()
77
                                ->booleanNode('user_enabled')->defaultValue(true)->end()
78
                                ->booleanNode('user_username_changed')->defaultValue(true)->end()
79
                                ->booleanNode('user_password_changed')->defaultValue(true)->end()
80
                            ->end()
81
                        ->end()
82
                    ->end()
83
                ->end()
84
            ->end();
85
86
        return $treeBuilder;
87
    }
88
}
89