Completed
Branch develop (598d0f)
by Benjamin
03:23
created

Configuration::getCacheTree()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 19
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 21
rs 9.6333
1
<?php
2
3
namespace Obblm\Core\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
 * Class Configuration
11
 */
12
class Configuration implements ConfigurationInterface
13
{
14
    public function getConfigTreeBuilder()
15
    {
16
        $treeBuilder = new TreeBuilder('obblm');
17
        $rootNode = $treeBuilder->getRootNode();
18
        $treeBuilder->getRootNode()
19
                ->children()
20
                    ->scalarNode('default_locale')
21
                        ->defaultValue('en')
22
                    ->end()
23
                ->end()
24
            ->end()
25
        ;
26
        $this->getCacheTree($rootNode);
27
28
        return $treeBuilder;
29
    }
30
    private function getCacheTree(ArrayNodeDefinition $rootNode)
31
    {
32
        return $rootNode
33
            ->fixXmlConfig('cache')
34
            ->children()
35
                ->arrayNode('caches')
36
                    ->addDefaultsIfNotSet()
37
                    ->children()
38
                        ->arrayNode('rules')
39
                            ->addDefaultsIfNotSet()
40
                            ->children()
41
                                ->scalarNode('adapter')
42
                                    ->isRequired()
43
                                    ->cannotBeEmpty()
44
                                    ->defaultValue('app.cache')
45
                                ->end()
46
                            ->end()
0 ignored issues
show
Bug introduced by
The method end() does not exist on Symfony\Component\Config...der\NodeParentInterface. It seems like you code against a sub-type of said class. However, the method does not exist in Symfony\Component\Config...ion\Builder\TreeBuilder. Are you sure you never get one of those? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

46
                            ->/** @scrutinizer ignore-call */ end()
Loading history...
47
                        ->end()
48
                    ->end()
49
                ->end()
50
            ->end();
51
    }
52
}
53