Completed
Push — develop ( d3bb0f...88b170 )
by Baptiste
05:23
created

Configuration::getConfigTreeBuilder()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 30
Code Lines 26

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 25
CRAP Score 1

Importance

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