Configuration   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 92.31%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 15
c 1
b 0
f 0
dl 0
loc 23
ccs 12
cts 13
cp 0.9231
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 21 2
1
<?php
2
/**
3
 * User: Simon Libaud
4
 * Date: 12/03/2017
5
 * Email: [email protected].
6
 */
7
namespace Sil\RouteSecurityBundle\DependencyInjection;
8
9
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
10
use Symfony\Component\Config\Definition\ConfigurationInterface;
11
12
/**
13
 * Class Configuration.
14
 */
15
class Configuration implements ConfigurationInterface
16
{
17 5
    public function getConfigTreeBuilder(): TreeBuilder
18
    {
19 5
        $tree = new TreeBuilder('sil_route_security');
20
        // Keep compatibility with symfony/config < 4.2
21 5
        if (false === method_exists($tree, 'getRootNode')) {
22
            $root = $tree->root('sil_route_security');
0 ignored issues
show
Bug introduced by
The method root() does not exist on Symfony\Component\Config...ion\Builder\TreeBuilder. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
            /** @scrutinizer ignore-call */ 
23
            $root = $tree->root('sil_route_security');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
23
        } else {
24 5
            $root = $tree->getRootNode();
25
        }
26
27
        $root
28 5
            ->children()
29 5
                ->booleanNode('enable_access_control')->defaultFalse()->end()
30 5
                ->scalarNode('secured_routes_format')->defaultNull()->end()
31 5
                ->scalarNode('ignored_routes_format')->defaultNull()->end()
32 5
                ->arrayNode('ignored_routes')->prototype('scalar')->end()->end()
33 5
                ->arrayNode('secured_routes')->prototype('scalar')->end()->end()
34 5
                ->scalarNode('naming_strategy')->defaultNull()->end()
35
        ;
36
37 5
        return $tree;
38
    }
39
}
40