Configuration::getConfigTreeBuilder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 31
Code Lines 26

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 26
c 1
b 0
f 0
dl 0
loc 31
rs 9.504
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Veslo project <https://github.com/symfony-doge/veslo>.
5
 *
6
 * (C) 2019 Pavel Petrov <[email protected]>.
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @license https://opensource.org/licenses/GPL-3.0 GPL-3.0
12
 */
13
14
declare(strict_types=1);
15
16
namespace Veslo\SanityBundle\DependencyInjection;
17
18
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
19
use Symfony\Component\Config\Definition\ConfigurationInterface;
20
21
/**
22
 * SanityBundle configuration.
23
 */
24
class Configuration implements ConfigurationInterface
25
{
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function getConfigTreeBuilder()
30
    {
31
        $treeBuilder = new TreeBuilder();
32
        $rootNode    = $treeBuilder->root('veslo_sanity');
33
34
        $rootNode
35
            ->children()
36
                ->arrayNode('vacancy')
37
                    ->children()
38
                        ->arrayNode('analyser')
39
                            ->children()
40
                                ->scalarNode('default_locale')
41
                                    ->info('Locale which will be used as a default sanity data translation locale')
42
                                    ->isRequired()
43
                                    ->cannotBeEmpty()
44
                                ->end()
45
                                ->arrayNode('locales')
46
                                    ->info('All locales which are supported for sanity data translations')
47
                                    ->example(['ru', 'ua', 'en'])
48
                                    ->requiresAtLeastOneElement()
49
                                    ->scalarPrototype()
50
                                    ->end()
51
                                ->end()
52
                            ->end()
53
                        ->end()
54
                    ->end()
55
                ->end()
56
            ->end()
57
        ;
58
59
        return $treeBuilder;
60
    }
61
}
62