Passed
Pull Request — master (#153)
by
unknown
07:37
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 32
Code Lines 27

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 27
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 32
rs 9.488
1
<?php
2
3
4
namespace BitBag\SyliusElasticsearchPlugin\DependencyInjection;
5
6
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
7
use Symfony\Component\Config\Definition\ConfigurationInterface;
8
9
class Configuration implements ConfigurationInterface
10
{
11
    public function getConfigTreeBuilder()
12
    {
13
        $treeBuilder = new TreeBuilder('bitbag_sylius_elasticsearch');
14
15
        $treeBuilder->getRootNode('bitbag_sylius_elasticsearch')
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Component\Config...eBuilder::getRootNode() has too many arguments starting with 'bitbag_sylius_elasticsearch'. ( Ignorable by Annotation )

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

15
        $treeBuilder->/** @scrutinizer ignore-call */ 
16
                      getRootNode('bitbag_sylius_elasticsearch')

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
16
            ->children()
17
                ->arrayNode('excluded_filter')
18
                    ->addDefaultsIfNotSet()
19
                    ->children()
20
                        ->arrayNode('options')
21
                            ->scalarPrototype()->end()
22
                            ->defaultValue([])
23
                        ->end()
24
                        ->arrayNode('attributes')
25
                            ->scalarPrototype()->end()
26
                            ->defaultValue([])
27
                         ->end()
28
                    ->end()
29
                ->end()
30
                ->integerNode('filter_attributes_max')
31
                    ->defaultValue(20)
32
                ->end()
33
                ->integerNode('filter_options_max')
34
                    ->defaultValue(20)
35
                ->end()
36
                ->scalarNode('shop_name_property_prefix')
37
                    ->defaultValue('sylius')
38
                ->end()
39
            ->end()
40
        ;
41
42
        return $treeBuilder;
43
    }
44
45
}