Configuration   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 14
c 1
b 0
f 1
dl 0
loc 25
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 20 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Locastic\SymfonyTranslationBundle\DependencyInjection;
6
7
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
8
use Symfony\Component\Config\Definition\ConfigurationInterface;
9
10
final class Configuration implements ConfigurationInterface
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function getConfigTreeBuilder(): TreeBuilder
16
    {
17
        $treeBuilder = new TreeBuilder('locastic_symfony_translation');
18
        if (\method_exists($treeBuilder, 'getRootNode')) {
19
            $rootNode = $treeBuilder->getRootNode();
20
        } else {
21
            // BC layer for symfony/config 4.1 and older
22
            $rootNode = $treeBuilder->root('locastic_symfony_translation');
0 ignored issues
show
Bug introduced by
The method root() does not exist on Symfony\Component\Config...ion\Builder\TreeBuilder. ( Ignorable by Annotation )

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

22
            /** @scrutinizer ignore-call */ 
23
            $rootNode = $treeBuilder->root('locastic_symfony_translation');

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...
23
        }
24
25
        $rootNode
26
            ->children()
27
                ->scalarNode('default_locale')
28
                    ->defaultValue('en_US')
29
                ->end()
30
                ->arrayNode('locales')->scalarPrototype()->end()->end()
31
            ->end()
32
        ;
33
34
        return $treeBuilder;
35
    }
36
}
37