Configuration   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 43 2
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
        // Keep compatibility with symfony/config < 4.2
39
        if (!method_exists($treeBuilder, 'getRootNode')) {
40
            $rootNode = $treeBuilder->root('sonata_doctrine_mongo_db_admin');
0 ignored issues
show
Deprecated Code introduced by Fran Moreno
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...
41
        } else {
42
            $rootNode = $treeBuilder->getRootNode();
43
        }
44
45
        $rootNode
46
            ->children()
47
                ->arrayNode('templates')
48
                    ->addDefaultsIfNotSet()
49
                    ->children()
50
                        ->arrayNode('form')
51
                            ->prototype('scalar')->end()
52
                            ->defaultValue(['@SonataDoctrineMongoDBAdmin/Form/form_admin_fields.html.twig'])
53
                        ->end()
54
                        ->arrayNode('filter')
55
                            ->prototype('scalar')->end()
56
                            ->defaultValue(['@SonataDoctrineMongoDBAdmin/Form/filter_admin_fields.html.twig'])
57
                        ->end()
58
                        ->arrayNode('types')
59
                            ->children()
60
                                ->arrayNode('list')
61
                                    ->useAttributeAsKey('name')
62
                                    ->prototype('scalar')->end()
63
                                ->end()
64
                                ->arrayNode('show')
65
                                    ->useAttributeAsKey('name')
66
                                    ->prototype('scalar')->end()
67
                                ->end()
68
                            ->end()
69
                        ->end()
70
                    ->end()
71
                ->end()
72
            ->end()
73
        ;
74
75
        return $treeBuilder;
76
    }
77
}
78