Completed
Push — master ( 06c1ce...67d37c )
by Jeroen
06:20
created

Configuration   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 95.83%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 64
ccs 46
cts 48
cp 0.9583
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B getConfigTreeBuilder() 0 58 2
1
<?php
2
3
namespace Kunstmaan\NodeBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
6
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
7
use Symfony\Component\Config\Definition\ConfigurationInterface;
8
9
/**
10
 * This is the class that validates and merges configuration from your app/config files
11
 *
12
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
13
 */
14
class Configuration implements ConfigurationInterface
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19 2
    public function getConfigTreeBuilder()
20
    {
21 2
        $treeBuilder = new TreeBuilder('kunstmaan_node');
22 2
        if (method_exists($treeBuilder, 'getRootNode')) {
23 2
            $rootNode = $treeBuilder->getRootNode();
24
        } else {
25
            // BC layer for symfony/config 4.1 and older
26
            $rootNode = $treeBuilder->root('kunstmaan_node');
0 ignored issues
show
Deprecated Code introduced by
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...
27
        }
28
29
        /* @var ArrayNodeDefinition $pages */
30
        $rootNode
31 2
            ->children()
32 2
                ->arrayNode('pages')
33 2
                    ->prototype('array')
34 2
                        ->children()
35 2
                            ->scalarNode('name')->isRequired()->end()
36 2
                            ->scalarNode('search_type')->end()
37 2
                            ->booleanNode('structure_node')->end()
38 2
                            ->booleanNode('indexable')->end()
39 2
                            ->scalarNode('icon')->defaultNull()->end()
40 2
                            ->scalarNode('hidden_from_tree')->end()
41 2
                            ->booleanNode('is_homepage')->end()
42 2
                            ->arrayNode('allowed_children')
43 2
                                ->prototype('array')
44 2
                                    ->beforeNormalization()
45
                                        ->ifString()->then(function ($v) {
46
                                            return ['class' => $v];
47 2
                                        })
48 2
                                    ->end()
49 2
                                    ->children()
50 2
                                        ->scalarNode('class')->isRequired()->end()
51 2
                                        ->scalarNode('name')->end()
52 2
                                    ->end()
53 2
                                ->end()
54 2
                            ->end()
55 2
                        ->end()
56 2
                    ->end()
57 2
                ->end()
58 2
                ->booleanNode('enable_permissions')->defaultTrue()->end()
59 2
                ->scalarNode('publish_later_stepping')->defaultValue('15')->end()
60 2
                ->scalarNode('unpublish_later_stepping')->defaultValue('15')->end()
61 2
                ->booleanNode('show_add_homepage')->defaultTrue()->end()
62 2
                ->booleanNode('show_duplicate_with_children')->defaultFalse()->end()
63 2
                ->booleanNode('enable_export_page_template')->defaultFalse()->end()
64 2
                ->arrayNode('lock')
65 2
                    ->addDefaultsIfNotSet()
66 2
                    ->canBeEnabled()
67 2
                    ->children()
68 2
                        ->scalarNode('check_interval')->defaultValue(15)->end()
69 2
                        ->scalarNode('threshold')->defaultValue(35)->end()
70 2
                        ->booleanNode('enabled')->defaultFalse()->end()
71 2
                    ->end()
72 2
                ->end()
73 2
            ->end();
74
75 2
        return $treeBuilder;
76
    }
77
}
78