Configuration::getConfigTreeBuilder()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 35

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 26
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 35
rs 9.36
c 0
b 0
f 0
ccs 26
cts 26
cp 1
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
namespace Goetas\TwitalBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
/**
9
 *
10
 * @author Asmir Mustafic <[email protected]>
11
 *
12
 */
13
class Configuration implements ConfigurationInterface
14
{
15
    /**
16
     * {@inheritDoc}
17
     */
18 7
    public function getConfigTreeBuilder()
19
    {
20 7
        $builder = new TreeBuilder('twital');
21
        $rootNode = method_exists(TreeBuilder::class, 'getRootNode') ? $builder->getRootNode() : $builder->root('twital');
0 ignored issues
show
Bug introduced by
The method root() does not seem to exist on object<Symfony\Component...on\Builder\TreeBuilder>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
22 7
23 7
        $rootNode
24 7
            ->children()
25 7
                ->booleanNode('full_twig_compatibility')->defaultFalse()->end()
26
            ->end()
27 7
            // filters
28 7
            ->fixXmlConfig('source_adapter')
29 7
            ->children()
30 7
                ->arrayNode('source_adapters')
31 7
                    ->requiresAtLeastOneElement()
32 7
                    ->useAttributeAsKey('service')
33 7
                    ->defaultValue(array(
34
                        'twital.source_adapter.xml' => array('pattern' => array('/\.xml\.twital$/')),
35
                        'twital.source_adapter.html5' => array('pattern' => array('/\.html\.twital$/')),
36
                        'twital.source_adapter.xhtml' => array('pattern' => array('/\.xhtml\.twital$/')),
37 7
                    ))
38 7
                    ->prototype('array')
39 7
                    ->children()
40 7
                        ->arrayNode('pattern')
41 7
                            ->isRequired()
42 7
                            ->requiresAtLeastOneElement()
43 7
                            ->prototype('scalar')->end()
44 7
                            ->end()
45 7
                        ->end()
46 7
                    ->end()
47 7
                    ->end()
48 7
                ->end()
49
            ->end();
50 7
51
        return $builder;
52
    }
53
}
54