Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 35
dl 0
loc 46
ccs 27
cts 27
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 39 1
1
<?php
2
3
/*
4
 * This file is part of the MsalsasVotingBundle package.
5
 *
6
 * (c) Manolo Salsas
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 Msalsas\VotingBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15
use Symfony\Component\Config\Definition\ConfigurationInterface;
16
17
class Configuration implements ConfigurationInterface
18
{
19
    /**
20
     * Generates the configuration tree builder.
21
     *
22
     * @return TreeBuilder $builder The tree builder
23
     */
24 4
    public function getConfigTreeBuilder()
25
    {
26 4
        $builder = new TreeBuilder();
27
28 4
        $rootNode = $builder->root('msalsas_voting');
29 4
        $rootNode->children()
30 4
            ->scalarNode('user_provider')
31 4
                ->isRequired()
32 4
                    ->defaultValue('\App\Entity\User')
33 4
            ->end()
34 4
            ->arrayNode('negative_reasons')
35 4
                ->isRequired()
36 4
                    ->scalarPrototype()
37 4
                        ->defaultValue([
38 4
                            'msalsas_voting.negative_reasons.irrelevant',
39
                            'msalsas_voting.negative_reasons.old',
40
                            'msalsas_voting.negative_reasons.tiredness',
41
                            'msalsas_voting.negative_reasons.sensationalist',
42
                            'msalsas_voting.negative_reasons.spam',
43
                            'msalsas_voting.negative_reasons.duplicated',
44
                            'msalsas_voting.negative_reasons.microblogging',
45
                            'msalsas_voting.negative_reasons.erroneous',
46
                            'msalsas_voting.negative_reasons.plagiarism',
47
                        ])
48 4
                ->end()
49 4
            ->end()
50 4
            ->integerNode('anonymous_percent_allowed')
51 4
                ->isRequired()
52 4
                    ->defaultValue(2)
53 4
                    ->min(1)
54 4
            ->end()
55 4
            ->integerNode('anonymous_min_allowed')
56 4
                ->isRequired()
57 4
                    ->defaultValue(50)
58 4
                    ->min(1)
59 4
            ->end()
60 4
            ->end();
61
62 4
        return $builder;
63
    }
64
}
65