Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 28 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Loevgaard\SyliusBarcodePlugin\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
        $treeBuilder = new TreeBuilder('loevgaard_sylius_barcode');
15
        $rootNode = $treeBuilder->getRootNode();
16
17
        $rootNode
18
            ->children()
19
                ->arrayNode('form')
20
                    ->addDefaultsIfNotSet()
21
                    ->children()
22
                        ->booleanNode('require')
23
                            ->defaultFalse()
24
                            ->info('If true the barcode field will be required in the product forms (both product and variant)')
25
                        ->end()
26
                        ->booleanNode('require_valid')
27
                            ->defaultFalse()
28
                            ->info('If true the barcode field will be validated when entered in the product forms (both product and variant)')
29
                        ->end()
30
                        ->booleanNode('require_unique')
31
                            ->defaultTrue()
32
                            ->info('If true the barcode unique constraint will be added to the field')
33
                        ->end()
34
                    ->end()
35
                ->end()
36
            ->end()
37
        ;
38
39
        return $treeBuilder;
40
    }
41
}
42