getConfigTreeBuilder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 9.6
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace OmnideskBundle\Configuration\Staff;
3
4
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
5
use Symfony\Component\Config\Definition\ConfigurationInterface;
6
7
/**
8
 * Class ListStaffRequestConfiguration
9
 * @package OmnideskBundle\Configuration\Staff
10
 */
11
class ListStaffRequestConfiguration 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
                    ->min(1)
40
                    ->max(100)
41
                ->end()
42
            ->end();
43
44
        return $treeBuilder;
45
    }
46
}
47