Completed
Push — master ( d09582...d2b5e4 )
by Peter
03:23 queued 12s
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 28

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 17
CRAP Score 2.0006

Importance

Changes 0
Metric Value
dl 0
loc 28
ccs 17
cts 18
cp 0.9444
rs 9.472
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2.0006
1
<?php
2
/**
3
 * GpsLab component.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2011, Peter Gribanov
7
 * @license   http://opensource.org/licenses/MIT
8
 */
9
10
namespace GpsLab\Bundle\PaginationBundle\DependencyInjection;
11
12
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
13
use Symfony\Component\Config\Definition\ConfigurationInterface;
14
15
class Configuration implements ConfigurationInterface
16
{
17
    /**
18
     * @return TreeBuilder
19
     */
20 1
    public function getConfigTreeBuilder()
21
    {
22 1
        $tree_builder = new TreeBuilder('gpslab_pagination');
23
24 1
        if (method_exists($tree_builder, 'getRootNode')) {
25
            // Symfony 4.2 +
26 1
            $root = $tree_builder->getRootNode();
27
        } else {
28
            // Symfony 4.1 and below
29
            $root = $tree_builder->root('gpslab_pagination');
0 ignored issues
show
Deprecated Code introduced by
The method Symfony\Component\Config...der\TreeBuilder::root() has been deprecated with message: since Symfony 4.3, pass the root name to the constructor instead

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
30
        }
31
32
        $root
33 1
            ->addDefaultsIfNotSet()
34 1
            ->children()
35 1
                ->scalarNode('max_navigate')
36 1
                    ->defaultValue(5)
37 1
                ->end()
38 1
                ->scalarNode('parameter_name')
39 1
                    ->defaultValue('page')
40 1
                ->end()
41 1
                ->scalarNode('template')
42 1
                    ->defaultValue('GpsLabPaginationBundle::pagination.html.twig')
43 1
                ->end()
44 1
            ->end();
45
46 1
        return $tree_builder;
47
    }
48
}
49