Configuration   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 43 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PTS\SyliusReferralPlugin\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('pts_sylius_referral_plugin');
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('pts_sylius_referral_plugin');
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

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

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...
23
        }
24
25
        $rootNode
26
            ->children()
27
                ->arrayNode('customers')
28
                ->children()
29
                    ->arrayNode('enroller_edit')
30
                        ->children()
31
                        ->booleanNode('enabled')->defaultFalse()
32
                        ->end()
33
                ->end()
34
            ->end();
35
36
        $rootNode
37
            ->children()
38
            ->arrayNode('channel_paths')
39
            ->arrayPrototype()
40
            ->children()
41
            ->scalarNode('name')->end()
42
            ->scalarNode('path')
43
            ->defaultValue('/')
44
            ->end()
45
            ->scalarNode('domain')
46
            ->defaultValue('*')
47
            ->end()
48
            ->booleanNode('default')
49
            ->defaultValue(false)
50
            ->end()
51
            ->end()
52
            ->end()
53
            ->end()
54
            ->end()
55
        ;
56
57
        return $treeBuilder;
58
    }
59
}
60