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.

Configuration::addTimeSection()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 15
rs 9.7666
c 0
b 0
f 0
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
    public function getConfigTreeBuilder()
21
    {
22
        $treeBuilder = new TreeBuilder('core23_antispam');
23
24
        $rootNode = $treeBuilder->getRootNode();
25
26
        \assert($rootNode instanceof ArrayNodeDefinition);
27
28
        $this->addTwigSection($rootNode);
29
        $this->addTimeSection($rootNode);
30
        $this->addHoneypotSection($rootNode);
31
32
        return $treeBuilder;
33
    }
34
35
    private function addTwigSection(ArrayNodeDefinition $node): void
36
    {
37
        $node
38
            ->children()
39
                ->arrayNode('twig')
40
                    ->addDefaultsIfNotSet()
41
                    ->children()
42
                        ->arrayNode('mail')
43
                            ->addDefaultsIfNotSet()
44
                            ->children()
45
                                ->scalarNode('css_class')->defaultNull()->end()
46
                                ->arrayNode('dot_text')
47
                                     ->useAttributeAsKey('id')
48
                                     ->requiresAtLeastOneElement()
49
                                     ->defaultValue(['[DOT]', '(DOT)', '[.]'])
50
                                     ->prototype('scalar')->end()
51
                                ->end()
52
                                ->arrayNode('at_text')
53
                                     ->useAttributeAsKey('id')
54
                                     ->requiresAtLeastOneElement()
55
                                     ->defaultValue(['[AT]', '(AT)', '[ÄT]'])
56
                                     ->prototype('scalar')->end()
57
                                ->end()
58
                            ->end()
59
                        ->end()
60
                    ->end()
61
                ->end()
62
            ->end()
63
        ;
64
    }
65
66
    private function addTimeSection(ArrayNodeDefinition $node): void
67
    {
68
        $node
69
            ->children()
70
                ->arrayNode('time')
71
                    ->addDefaultsIfNotSet()
72
                    ->children()
73
                        ->integerNode('min')->defaultValue(5)->end()
74
                        ->integerNode('max')->defaultValue(3600)->end()
75
                        ->booleanNode('global')->defaultFalse()->end()
76
                    ->end()
77
                ->end()
78
            ->end()
79
        ;
80
    }
81
82
    private function addHoneypotSection(ArrayNodeDefinition $node): void
83
    {
84
        $node
85
            ->children()
86
                ->arrayNode('honeypot')
87
                    ->addDefaultsIfNotSet()
88
                    ->children()
89
                        ->scalarNode('field')->defaultValue('email_address')->end()
90
                        ->scalarNode('class')
91
                            ->defaultValue('hidden')
92
                            ->info('CSS class to hide the honeypot. If not set a "style:hidden" attribute ist set.')
93
                        ->end()
94
                        ->booleanNode('global')->defaultFalse()->end()
95
                        ->scalarNode('provider')->defaultValue('core23_antispam.provider.session')->end()
96
                    ->end()
97
                ->end()
98
            ->end()
99
        ;
100
    }
101
}
102