Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 38 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\DoctrineMongoDBAdminBundle\DependencyInjection;
15
16
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
17
use Symfony\Component\Config\Definition\ConfigurationInterface;
18
19
/**
20
 * This class contains the configuration information for the bundle.
21
 *
22
 * This information is solely responsible for how the different configuration
23
 * sections are normalized, and merged.
24
 *
25
 * @author Michael Williams <[email protected]>
26
 */
27
class Configuration implements ConfigurationInterface
28
{
29
    /**
30
     * Generates the configuration tree.
31
     *
32
     * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder
33
     */
34
    public function getConfigTreeBuilder()
35
    {
36
        $treeBuilder = new TreeBuilder('sonata_doctrine_mongo_db_admin');
37
38
        $rootNode = $treeBuilder->getRootNode();
39
40
        $rootNode
41
            ->children()
42
                ->arrayNode('templates')
43
                    ->addDefaultsIfNotSet()
44
                    ->children()
45
                        ->arrayNode('form')
46
                            ->prototype('scalar')->end()
47
                            ->defaultValue(['@SonataDoctrineMongoDBAdmin/Form/form_admin_fields.html.twig'])
48
                        ->end()
49
                        ->arrayNode('filter')
50
                            ->prototype('scalar')->end()
51
                            ->defaultValue(['@SonataDoctrineMongoDBAdmin/Form/filter_admin_fields.html.twig'])
52
                        ->end()
53
                        ->arrayNode('types')
54
                            ->children()
55
                                ->arrayNode('list')
56
                                    ->useAttributeAsKey('name')
57
                                    ->prototype('scalar')->end()
58
                                ->end()
59
                                ->arrayNode('show')
60
                                    ->useAttributeAsKey('name')
61
                                    ->prototype('scalar')->end()
62
                                ->end()
63
                            ->end()
64
                        ->end()
65
                    ->end()
66
                ->end()
67
            ->end()
68
        ;
69
70
        return $treeBuilder;
71
    }
72
}
73