Failed Conditions
Pull Request — master (#12)
by Yo
01:48
created

src/DependencyInjection/Configuration.php (2 issues)

1
<?php
2
namespace Yoanm\SymfonyJsonRpcHttpServer\DependencyInjection;
3
4
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
5
use Symfony\Component\Config\Definition\ConfigurationInterface;
6
7
class Configuration implements ConfigurationInterface
8
{
9 5
    public function getConfigTreeBuilder()
10
    {
11 5
        $treeBuilder = new TreeBuilder();
12
13 5
        $rootNode = $treeBuilder->root(JsonRpcHttpServerExtension::EXTENSION_IDENTIFIER);
14
15
        $rootNode
16 5
            ->children()
17 5
                ->variableNode('method_resolver')
18 5
                    ->info('Your custom method resolver service')
19 5
                    ->treatNullLike(false)
20 5
                    ->defaultFalse()
21 5
                ->end()
22 5
                ->arrayNode('methods_mapping')
23 5
                    ->requiresAtLeastOneElement()
24 5
                    ->normalizeKeys(false)
25 5
                    ->arrayPrototype()
26 5
                        ->beforeNormalization()
27
                            // Convert simple to an array with the string as service
28
                            ->ifString()->then(function($v) {return ['service' => $v];})
0 ignored issues
show
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
Opening brace must be the last content on the line
Loading history...
29 5
                        ->end()
30 5
                        ->children()
31 5
                            ->scalarNode('service')
32 5
                                ->isRequired()
33 5
                                ->cannotBeEmpty()
34 5
                            ->end()
35 5
                            ->arrayNode('aliases')
36 5
                                ->requiresAtLeastOneElement()
37 5
                                ->beforeNormalization()
38 5
                                    ->castToArray()
39 5
                                ->end()
40 5
                                ->scalarPrototype()->end()
41 5
                            ->end()
42 5
                        ->end()
43 5
                    ->end()
44 5
                ->end()
45 5
            ->end()
46
        ;
47
48 5
        return $treeBuilder;
49
    }
50
}
51