Configuration   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 20
c 2
b 0
f 0
dl 0
loc 28
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 26 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Setono\SyliusStrandsPlugin\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
    public function getConfigTreeBuilder(): TreeBuilder
13
    {
14
        if (method_exists(TreeBuilder::class, 'getRootNode')) {
15
            $treeBuilder = new TreeBuilder('setono_sylius_strands');
16
            $rootNode = $treeBuilder->getRootNode();
17
        } else {
18
            // BC layer for symfony/config 4.1 and older
19
            $treeBuilder = new TreeBuilder();
20
            $rootNode = $treeBuilder->root('setono_sylius_strands');
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

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

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...
21
        }
22
23
        $rootNode
24
            ->children()
25
                ->scalarNode('api_id')
26
                    ->isRequired()
27
                    ->cannotBeEmpty()
28
                    ->info('This can be found here: https://retail.strands.com/account/info/')
29
                ->end()
30
                ->booleanNode('variant_based')
31
                    ->defaultFalse()
32
                    ->info('If true the various injections will inject variant codes instead of product codes')
33
                ->end()
34
            ->end()
35
        ;
36
37
        return $treeBuilder;
38
    }
39
}
40