Completed
Branch v1.x-dev (5736e4)
by Benjamin
04:09
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 12
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 16
ccs 13
cts 13
cp 1
crap 1
rs 9.8666
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 1
    public function getConfigTreeBuilder()
15
    {
16 1
        $treeBuilder = new TreeBuilder('obblm');
17 1
        $rootNode = $treeBuilder->getRootNode();
18 1
        $treeBuilder->getRootNode()
19 1
                ->children()
20 1
                    ->scalarNode('upload_directory')
21 1
                    ->end()
22 1
                    ->scalarNode('public_cache_directory')
23 1
                    ->end()
24 1
                ->end()
25 1
            ->end()
26
        ;
27 1
        $this->getCacheTree($rootNode);
28
29 1
        return $treeBuilder;
30
    }
31 1
    private function getCacheTree(ArrayNodeDefinition $rootNode)
32
    {
33
        return $rootNode
34 1
            ->fixXmlConfig('cache')
35 1
            ->children()
36 1
                ->arrayNode('caches')
37 1
                    ->addDefaultsIfNotSet()
38 1
                    ->children()
39 1
                        ->arrayNode('rules')
40 1
                            ->addDefaultsIfNotSet()
41 1
                            ->children()
42 1
                                ->scalarNode('adapter')
43 1
                                    ->isRequired()
44 1
                                    ->cannotBeEmpty()
45 1
                                    ->defaultValue('app.cache')
46 1
                                ->end()
47 1
                            ->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

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