Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 0
cbo 3
dl 0
loc 43
ccs 35
cts 35
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B getConfigTreeBuilder() 0 37 1
1
<?php
2
3
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[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
12
namespace ONGR\TranslationsBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15
use Symfony\Component\Config\Definition\ConfigurationInterface;
16
17
/**
18
 * This is the class that validates and merges configuration from app/config files.
19
 */
20
class Configuration implements ConfigurationInterface
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25 7
    public function getConfigTreeBuilder()
26
    {
27 7
        $treeBuilder = new TreeBuilder();
28 7
        $rootNode = $treeBuilder->root('ongr_translations');
29
30
        $rootNode
31 7
            ->addDefaultsIfNotSet()
32 7
            ->children()
33 7
                ->arrayNode('repository')
34 7
                    ->info('Repository used for connecting with elasticsearch client.')
35 7
                    ->children()
36 7
                        ->scalarNode('translation')->isRequired()
37 7
                        ->end()
38 7
                        ->scalarNode('history')->isRequired()
39 7
                        ->end()
40 7
                    ->end()
41 7
                ->end()
42 7
                ->scalarNode('list_size')
43 7
                    ->info('Maximum amount of translations displayed in the list')
44 7
                    ->defaultValue(1000)
45 7
                ->end()
46 7
                ->arrayNode('locales')
47 7
                    ->requiresAtleastOneElement()
48 7
                    ->info('Locales to manage (e.g. "en", "de", "en_eur").')
49 7
                    ->prototype('scalar')->end()
50 7
                ->end()
51 7
                ->arrayNode('bundles')
52 7
                    ->info('Bundles to scan for translations.')
53 7
                    ->prototype('scalar')
54 7
                    ->defaultValue([])
55 7
                    ->end()
56 7
                ->end()
57 7
            ->end()
58 7
        ->end();
59 7
60 7
        return $treeBuilder;
61 7
    }
62
}
63