GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( caac67...e703d4 )
by Christian
06:26
created

Configuration::addTwigSection()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 29
Code Lines 27

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 29
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 27
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[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
namespace Core23\AntiSpamBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
15
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
16
use Symfony\Component\Config\Definition\ConfigurationInterface;
17
18
final class Configuration implements ConfigurationInterface
19
{
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function getConfigTreeBuilder()
24
    {
25
        $treeBuilder = new TreeBuilder();
26
27
        /** @var ArrayNodeDefinition $node */
28
        $node = $treeBuilder->root('core23_antispam');
29
30
        $this->addTwigSection($node);
31
        $this->addTimeSection($node);
32
        $this->addHoneypotSection($node);
33
34
        return $treeBuilder;
35
    }
36
37
    /**
38
     * @param ArrayNodeDefinition $node
39
     */
40
    private function addTwigSection(ArrayNodeDefinition $node): void
41
    {
42
        $node
43
            ->children()
44
                ->arrayNode('twig')
45
                    ->addDefaultsIfNotSet()
46
                    ->children()
47
                        ->arrayNode('mail')
48
                            ->addDefaultsIfNotSet()
49
                            ->children()
50
                                ->scalarNode('css_class')->defaultValue('spamme')->end()
51
                                ->arrayNode('dot_text')
52
                                     ->useAttributeAsKey('id')
53
                                     ->requiresAtLeastOneElement()
54
                                     ->defaultValue(['[DOT]', '(DOT)', '[.]'])
55
                                     ->prototype('scalar')->end()
56
                                ->end()
57
                                ->arrayNode('at_text')
58
                                     ->useAttributeAsKey('id')
59
                                     ->requiresAtLeastOneElement()
60
                                     ->defaultValue(['[AT]', '(AT)', '[ÄT]'])
61
                                     ->prototype('scalar')->end()
62
                                ->end()
63
                            ->end()
64
                        ->end()
65
                    ->end()
66
                ->end()
67
            ->end();
68
    }
69
70
    /**
71
     * @param ArrayNodeDefinition $node
72
     */
73
    private function addTimeSection(ArrayNodeDefinition $node): void
74
    {
75
        $node
76
            ->children()
77
                ->arrayNode('time')
78
                    ->addDefaultsIfNotSet()
79
                    ->children()
80
                        ->integerNode('min')->defaultValue(5)->end()
81
                        ->integerNode('max')->defaultValue(3600)->end()
82
                        ->booleanNode('global')->defaultFalse()->end()
83
                    ->end()
84
                ->end()
85
            ->end()
86
        ;
87
    }
88
89
    /**
90
     * @param ArrayNodeDefinition $node
91
     */
92
    private function addHoneypotSection(ArrayNodeDefinition $node): void
93
    {
94
        $node
95
            ->children()
96
                ->arrayNode('honeypot')
97
                    ->addDefaultsIfNotSet()
98
                    ->children()
99
                        ->scalarNode('field')->defaultValue('email_address')->end()
100
                        ->scalarNode('class')
101
                            ->defaultValue('hidden')
102
                            ->info('CSS class to hide the honeypot. If not set a "style:hidden" attribute ist set.')
103
                        ->end()
104
                        ->booleanNode('global')->defaultFalse()->end()
105
                        ->scalarNode('provider')->defaultValue('core23_antispam.provider.session')->end()
106
                    ->end()
107
                ->end()
108
            ->end();
109
    }
110
}
111