Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 1
c 2
b 0
f 0
lcom 0
cbo 3
dl 0
loc 42
ccs 30
cts 30
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B getConfigTreeBuilder() 0 36 1
1
<?php
2
3
namespace Zenstruck\ObjectRoutingBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
/**
9
 * @author Kevin Bond <[email protected]>
10
 */
11
class Configuration implements ConfigurationInterface
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16 3
    public function getConfigTreeBuilder()
17
    {
18 3
        $treeBuilder = new TreeBuilder();
19 3
        $rootNode = $treeBuilder->root('zenstruck_object_routing');
20
21
        $rootNode
22 3
            ->children()
23 3
                ->arrayNode('class_map')
24 3
                    ->useAttributeAsKey('class')
25 3
                    ->prototype('array')
26 3
                        ->children()
27 3
                            ->scalarNode('default_route')
28 3
                                ->defaultNull()
29 3
                                ->info('Optional - The route to use when an object is passed as the 1st parameter of Router::generate()')
30 3
                            ->end()
31 3
                            ->arrayNode('default_parameters')
32 3
                                ->info('Route parameter as key, object method/public property as value (can omit key if object method/property is the same)')
33 3
                                ->example(array('id', 'path'))
34 3
                                ->prototype('scalar')->end()
35 3
                            ->end()
36 3
                            ->arrayNode('routes')
37 3
                                ->info('Route name as key, parameter array as value (can leave parameter array as null if same as default_parameters)')
38 3
                                ->example(array('blog_show' => '~', 'blog_edit' => array('id')))
39 3
                                ->useAttributeAsKey('route_name')
40 3
                                ->prototype('array')
41 3
                                    ->prototype('scalar')->end()
42 3
                                ->end()
43 3
                            ->end()
44 3
                        ->end()
45 3
                    ->end()
46 3
                ->end()
47 3
            ->end()
48
        ;
49
50 3
        return $treeBuilder;
51
    }
52
}
53