getConfigTreeBuilder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 34

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 34
rs 9.376
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace OmnideskBundle\Configuration\User;
3
4
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
5
use Symfony\Component\Config\Definition\ConfigurationInterface;
6
7
/**
8
 * Class ListUserRequestConfiguration
9
 * @package OmnideskBundle\Configuration\User
10
 */
11
class ListUserRequestConfiguration implements ConfigurationInterface
12
{
13
    /**
14
     * @var int
15
     */
16
    const DEFAULT_PAGE = 1;
17
18
    /**
19
     * @var int
20
     */
21
    const DEFAULT_LIMIT = 100;
22
23
    /**
24
     * @return TreeBuilder
25
     */
26
    public function getConfigTreeBuilder()
27
    {
28
        $treeBuilder = new TreeBuilder();
29
30
        $rootNode = $treeBuilder->root('params');
31
32
        $rootNode
33
            ->children()
34
                ->integerNode('page')
35
                    ->defaultValue(self::DEFAULT_PAGE)
36
                ->end()
37
                ->integerNode('limit')
38
                    ->defaultValue(self::DEFAULT_LIMIT)
39
                ->end()
40
                ->scalarNode('user_email')
41
                    ->defaultNull()
42
                ->end()
43
                ->scalarNode('user_phone')
44
                    ->defaultNull()
45
                ->end()
46
                ->integerNode('language_id')
47
                    ->defaultNull()
48
                ->end()
49
                ->arrayNode('custom_fields')
50
                    ->prototype('scalar')
51
                    ->end()
52
                ->end()
53
                ->booleanNode('amount_of_cases')
54
                    ->defaultFalse()
55
                ->end()
56
            ->end();
57
58
        return $treeBuilder;
59
    }
60
}
61