Completed
Push — master ( 1b817e...6c15b7 )
by Jeroen
39:29
created

DependencyInjection/Configuration.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Kunstmaan\TranslatorBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
/**
9
 * This is the class that validates and merges configuration from your app/config files
10
 *
11
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
12
 */
13
class Configuration implements ConfigurationInterface
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function getConfigTreeBuilder()
19
    {
20
        $treeBuilder = new TreeBuilder();
21
        $rootNode = $treeBuilder->root('kuma_translator');
22
23
        $availableStorageEngines = array('orm');
24
        $defaultFileFormats = array('yml', 'xliff');
25
26
        $rootNode
0 ignored issues
show
The method scalarNode() does not seem to exist on object<Symfony\Component...odeDefinitionInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
27
            ->children()
28
                ->booleanNode('enabled')
29
                    ->defaultTrue()
30
                ->end()
31
32
                ->scalarNode('default_bundle')
33
                    ->cannotBeEmpty()
34
                    ->defaultValue('own')
35
                ->end()
36
37
                ->arrayNode('bundles')
38
                    ->defaultValue(array())
39
                    ->prototype('scalar')->end()
40
                ->end()
41
42
                ->scalarNode('cache_dir')
43
                    ->cannotBeEmpty()
44
                    ->defaultValue('%kernel.cache_dir%/translations')
45
                ->end()
46
47
                ->booleanNode('debug')
48
                    ->defaultValue(null)
49
                ->end()
50
51
                ->arrayNode('managed_locales')
52
                    ->defaultValue(array())
53
                    ->prototype('scalar')->end()
54
                ->end()
55
56
                ->arrayNode('file_formats')
57
                    ->defaultValue($defaultFileFormats)
58
                    ->prototype('scalar')->end()
59
                ->end()
60
61
                ->arrayNode('storage_engine')
62
                    ->addDefaultsIfNotSet()
63
                    ->children()
64
                        ->scalarNode('type')
65
                            ->cannotBeEmpty()
66
                            ->defaultValue('orm')
67
                            ->validate()
68
                                ->ifNotInArray($availableStorageEngines)
69
                                ->thenInvalid('Storage engine should be one of the following: '.implode(', ', $availableStorageEngines))
70
                            ->end()
71
                        ->end()
72
                    ->end()
73
                ->end()
74
            ->end()
75
        ;
76
77
        return $treeBuilder;
78
    }
79
}
80