Passed
Pull Request — master (#24)
by Christophe
01:37
created

Configuration   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 96.67%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 32
c 1
b 0
f 0
dl 0
loc 39
ccs 29
cts 30
cp 0.9667
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 37 2
1
<?php
2
3
namespace Incenteev\TranslationCheckerBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
class Configuration implements ConfigurationInterface
9
{
10 6
    public function getConfigTreeBuilder(): TreeBuilder
11
    {
12 6
        $treeBuilder = new TreeBuilder('incenteev_translation_checker');
13
14 6
        if (method_exists($treeBuilder, 'getRootNode')) {
15 6
            $rootNode = $treeBuilder->getRootNode();
16
        } else {
17
            $rootNode = $treeBuilder->root('incenteev_translation_checker');
0 ignored issues
show
Deprecated Code introduced by
The function Symfony\Component\Config...der\TreeBuilder::root() has been deprecated: since Symfony 4.3, pass the root name to the constructor instead ( Ignorable by Annotation )

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

17
            $rootNode = /** @scrutinizer ignore-deprecated */ $treeBuilder->root('incenteev_translation_checker');

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
18
        }
19
20
        $rootNode
21 6
            ->children()
22 6
                ->arrayNode('extraction')
23 6
                    ->addDefaultsIfNotSet()
24 6
                    ->fixXmlConfig('bundle')
25 6
                    ->children()
26 6
                        ->arrayNode('bundles')
27 6
                            ->prototype('scalar')->end()
28 6
                        ->end()
29 6
                        ->arrayNode('js')
30 6
                            ->addDefaultsIfNotSet()
31 6
                            ->fixXmlConfig('path')
32 6
                            ->children()
33 6
                                ->scalarNode('default_domain')
34 6
                                    ->info('The default domain used for JS translation (should match the JsTranslationBundle config)')
35 6
                                    ->defaultValue('messages')
36 6
                                ->end()
37 6
                                ->arrayNode('paths')
38 6
                                    ->prototype('scalar')->end()
39 6
                                ->end()
40 6
                            ->end()
41 6
                        ->end()
42 6
                    ->end()
43 6
                ->end()
44 6
            ->end();
45
46 6
        return $treeBuilder;
47
    }
48
}
49