Completed
Push — 2.x ( 359f6e )
by Sullivan
14:45
created

Configuration   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 3
dl 0
loc 52
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B getConfigTreeBuilder() 0 44 1
1
<?php
2
3
/*
4
 * This file is part of the Sonata project.
5
 *
6
 * (c) Thomas Rabaix <[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 Sonata\DoctrineORMAdminBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15
use Symfony\Component\Config\Definition\ConfigurationInterface;
16
17
/**
18
 * This class contains the configuration information for the bundle
19
 *
20
 * This information is solely responsible for how the different configuration
21
 * sections are normalized, and merged.
22
 *
23
 * @author Michael Williams <[email protected]>
24
 */
25
class Configuration implements ConfigurationInterface
26
{
27
    /**
28
     * Generates the configuration tree.
29
     *
30
     * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder
31
     */
32
    public function getConfigTreeBuilder()
33
    {
34
        $treeBuilder = new TreeBuilder();
35
        $rootNode = $treeBuilder->root('sonata_doctrine_orm_admin', 'array');
36
37
        $rootNode
38
            ->children()
39
                ->scalarNode('entity_manager')->defaultNull()->end()
40
                ->arrayNode('audit')
41
                    ->addDefaultsIfNotSet()
42
                    ->children()
43
                        ->booleanNode('force')->defaultTrue()->end()
44
                    ->end()
45
                ->end()
46
                ->arrayNode('templates')
47
                    ->addDefaultsIfNotSet()
48
                    ->children()
49
                        ->arrayNode('form')
50
                            ->prototype('scalar')->end()
51
                            ->defaultValue(array('SonataDoctrineORMAdminBundle:Form:form_admin_fields.html.twig'))
52
                        ->end()
53
                        ->arrayNode('filter')
54
                            ->prototype('scalar')->end()
55
                            ->defaultValue(array('SonataDoctrineORMAdminBundle:Form:filter_admin_fields.html.twig'))
56
                        ->end()
57
                        ->arrayNode('types')
58
                            ->children()
59
                                ->arrayNode('list')
60
                                    ->useAttributeAsKey('name')
61
                                    ->prototype('scalar')->end()
62
                                ->end()
63
                                ->arrayNode('show')
64
                                    ->useAttributeAsKey('name')
65
                                    ->prototype('scalar')->end()
66
                                ->end()
67
                            ->end()
68
                        ->end()
69
                    ->end()
70
                ->end()
71
            ->end()
72
        ;
73
74
        return $treeBuilder;
75
    }
76
}
77