Configuration   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 35
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 25 2
1
<?php
2
3
/*
4
 * This file is part of the Pagerfanta package.
5
 *
6
 * (c) Pablo Díez <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WhiteOctober\PagerfantaBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15
use Symfony\Component\Config\Definition\ConfigurationInterface;
16
17
/**
18
 * Configuration
19
 *
20
 * @author Julien Brochet <[email protected]>
21
 */
22
class Configuration implements ConfigurationInterface
23
{
24
    const EXCEPTION_STRATEGY_TO_HTTP_NOT_FOUND = 'to_http_not_found';
25
26
    /**
27
     * Generates the configuration tree builder.
28
     *
29
     * @return TreeBuilder
30
     */
31
    public function getConfigTreeBuilder()
32
    {
33
        $treeBuilder = new TreeBuilder('white_october_pagerfanta', 'array');
34
35
        if (method_exists($treeBuilder, 'getRootNode')) {
36
            $rootNode = $treeBuilder->getRootNode();
37
        } else {
38
            // BC layer for symfony/config 4.1 and older
39
            $rootNode = $treeBuilder->root('white_october_pagerfanta', 'array');
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...
40
        }
41
42
        $rootNode
43
            ->children()
44
                ->scalarNode('default_view')->defaultValue('default')->end()
45
                ->arrayNode('exceptions_strategy')
46
                    ->addDefaultsIfNotSet()
47
                    ->children()
48
                        ->scalarNode('out_of_range_page')->defaultValue(self::EXCEPTION_STRATEGY_TO_HTTP_NOT_FOUND)->end()
49
                        ->scalarNode('not_valid_current_page')->defaultValue(self::EXCEPTION_STRATEGY_TO_HTTP_NOT_FOUND)->end()
50
                    ->end()
51
                ->end()
52
            ->end();
53
54
        return $treeBuilder;
55
    }
56
}
57