Passed
Push — master ( 6ba977...0a48c5 )
by Michael
07:39
created

JsonApiConfiguration::getConfigTreeBuilder()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 15
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 26
ccs 15
cts 15
cp 1
rs 8.8571
cc 1
eloc 19
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Mikemirten\Bundle\JsonApiBundle\DependencyInjection;
5
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
8
9
class JsonApiConfiguration implements ConfigurationInterface
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14 2
    public function getConfigTreeBuilder()
15
    {
16 2
        $builder  = new TreeBuilder();
17 2
        $children = $builder->root('mrtn_json_api')->children();
18
19 2
        $children->arrayNode('view_listener_mapping_handler')
20 2
            ->addDefaultsIfNotSet()
21 2
            ->children()
22 2
                ->scalarNode('default_mapper')
23 2
                    ->defaultValue('default');
24
25 2
        $children->arrayNode('mappers')
26 2
            ->defaultValue(['default' => [
27
                'handlers' => [
28
                    'attribute',
29
                    'relationship',
30
                    'link'
31
                ]
32
            ]])
33 2
            ->prototype('array')
34 2
                ->children()
35 2
                    ->arrayNode('handlers')
36 2
                        ->prototype('scalar');
37
38 2
        return $builder;
39
    }
40
}