Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 28
c 2
b 0
f 0
dl 0
loc 34
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 32 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Roukmoute\HashidsBundle\DependencyInjection;
6
7
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
8
use Symfony\Component\Config\Definition\ConfigurationInterface;
9
10
class Configuration implements ConfigurationInterface
11
{
12
    public function getConfigTreeBuilder(): TreeBuilder
13
    {
14
        $treeBuilder = new TreeBuilder('roukmoute_hashids');
15
        $rootNode = $treeBuilder->getRootNode();
16
17
        $rootNode
18
            ->children()
19
                ->scalarNode('salt')
20
                    ->defaultValue('')
21
                    ->info('if set, the hashids will differ from everyone else\'s.')
22
                ->end()
23
                ->integerNode('min_hash_length')
24
                    ->info('if set, will generate minimum length for the id.')
25
                    ->defaultValue(0)
26
                    ->min(0)
27
                ->end()
28
                ->scalarNode('alphabet')
29
                    ->info('if set, will use only characters of alphabet string.')
30
                    ->defaultValue('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890')
31
                ->end()
32
                ->booleanNode('passthrough')
33
                    ->info('if true, will continue with others param converters.')
34
                    ->defaultFalse()
35
                ->end()
36
                ->booleanNode('auto_convert')
37
                    ->info('if true, try to convert all arguments in controller. Except use "_hash_" in specific routing variables.')
38
                    ->defaultFalse()
39
                ->end()
40
            ->end()
41
        ;
42
43
        return $treeBuilder;
44
    }
45
}
46