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