Completed
Push — develop ( 2d5c57...fc6ffb )
by Baptiste
02:13
created

Configuration::getConfigTreeBuilder()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 45
Code Lines 41

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 40
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 45
ccs 40
cts 40
cp 1
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 41
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Rest\ServerBundle\DependencyInjection;
5
6
use Symfony\Component\Config\Definition\{
7
    Builder\TreeBuilder,
8
    Builder\NodeBuilder,
9
    ConfigurationInterface
10
};
11
12
final class Configuration implements ConfigurationInterface
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17 2
    public function getConfigTreeBuilder()
18
    {
19 2
        $treeBuilder = new TreeBuilder;
20 2
        $root = $treeBuilder->root('innmind_rest_server');
21
22
        $root
23 2
            ->children()
24 2
                ->arrayNode('types')
25 2
                    ->defaultValue([])
26 2
                    ->prototype('scalar')->end()
27 2
                ->end()
28 2
                ->arrayNode('accept')
29 2
                    ->info('The list of formats you accept in the "Accept" header')
30 2
                    ->useAttributeAsKey('name')
31 2
                    ->requiresAtLeastOneElement()
32 2
                    ->prototype('array')
33 2
                        ->children()
34 2
                            ->integerNode('priority')->end()
35 2
                            ->arrayNode('media_types')
36 2
                                ->useAttributeAsKey('name')
37 2
                                ->requiresAtLeastOneElement()
38 2
                                ->prototype('scalar')->end()
39 2
                            ->end()
40 2
                        ->end()
41 2
                    ->end()
42 2
                ->end()
43 2
                ->arrayNode('content_type')
44 2
                    ->info('The list of formats you support as content output')
45 2
                    ->useAttributeAsKey('name')
46 2
                    ->requiresAtLeastOneElement()
47 2
                    ->prototype('array')
48 2
                        ->children()
49 2
                            ->integerNode('priority')->end()
50 2
                            ->arrayNode('media_types')
51 2
                                ->useAttributeAsKey('name')
52 2
                                ->requiresAtLeastOneElement()
53 2
                                ->prototype('integer')->end()
54 2
                            ->end()
55 2
                        ->end()
56 2
                    ->end()
57 2
                ->end()
58 2
            ->end();
59
60 2
        return $treeBuilder;
61
    }
62
}
63