Completed
Push — master ( ad3b69...02c092 )
by John
09:08 queued 05:48
created

Configuration   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 13
Bugs 3 Features 0
Metric Value
wmc 1
c 13
b 3
f 0
lcom 0
cbo 3
dl 0
loc 39
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B getConfigTreeBuilder() 0 33 1
1
<?php declare(strict_types = 1);
2
/*
3
 * This file is part of the KleijnWeb\SwaggerBundle package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace KleijnWeb\SwaggerBundle\DependencyInjection;
10
11
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
12
use Symfony\Component\Config\Definition\ConfigurationInterface;
13
14
/**
15
 * @author John Kleijn <[email protected]>
16
 */
17
class Configuration implements ConfigurationInterface
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function getConfigTreeBuilder()
23
    {
24
        $treeBuilder = new TreeBuilder();
25
        $rootNode    = $treeBuilder->root('swagger');
26
27
        $rootNode
28
            ->children()
29
            ->scalarNode('validate_responses')->defaultFalse()
30
            ->end()
31
            ->arrayNode('hydrator')
32
            ->children()
33
            ->arrayNode('namespaces')->isRequired()
34
            ->beforeNormalization()
35
            ->ifString()
36
            ->then(function ($v) {
37
                return [$v];
38
            })
39
            ->end()
40
            ->prototype('scalar')
41
            ->end()
42
            ->end()
43
            ->end()
44
            ->end()
45
            ->arrayNode('document')
46
            ->addDefaultsIfNotSet()
47
            ->children()
48
            ->scalarNode('cache')->isRequired()->defaultFalse()->end()->scalarNode('base_path')->defaultValue('')->end()
49
            ->end()
50
            ->end()
51
            ->end();
52
53
        return $treeBuilder;
54
    }
55
}
56