Configuration::getConfigTreeBuilder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 17
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 22
ccs 17
cts 17
cp 1
rs 9.2
c 0
b 0
f 0
cc 1
eloc 18
nc 1
nop 0
crap 1
1
<?php
2
3
namespace TreeHouse\BaseApiBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
class Configuration implements ConfigurationInterface
9
{
10
    /**
11
     * @inheritdoc
12
     */
13 24
    public function getConfigTreeBuilder()
14
    {
15 24
        $treeBuilder = new TreeBuilder();
16 24
        $rootNode = $treeBuilder->root('tree_house_base_api');
17
        $rootNode
18 24
            ->children()
19 24
                ->scalarNode('token_host')
20 24
                    ->isRequired()
21 24
                ->end()
22 24
                ->scalarNode('host')
23 24
                    ->isRequired()
24 24
                ->end()
25 24
                ->scalarNode('allowed_origins')
26 24
                    ->info('CORS: specifies which origins are allowed to access the api.')
27 24
                    ->example('http://example.org')
28 24
                    ->defaultValue('*')
29 24
                ->end()
30 24
            ->end()
31
        ;
32
33 24
        return $treeBuilder;
34
    }
35
}
36