Configuration::getConfigTreeBuilder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Facile\CrossbarHTTPPublisherBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
6
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
7
use Symfony\Component\Config\Definition\ConfigurationInterface;
8
9
/**
10
 * Class Configuration
11
 * @package Facile\CrossbarHTTPPublisherBundle\DependencyInjection
12
 */
13
class Configuration implements ConfigurationInterface
14
{
15
    /**
16
     * Generates the configuration tree builder.
17
     */
18
    public function getConfigTreeBuilder(): TreeBuilder
19
    {
20 1
        $tree = new TreeBuilder('facile_crossbar_http_publisher');
21
        $rootNode = $tree->getRootNode();
22 1
        $this->addConnections($rootNode);
23 1
24 1
        return $tree;
25
    }
26 1
27
    protected function addConnections(ArrayNodeDefinition $node): void
28
    {
29
        $node
30
            ->fixXmlConfig('connection')
31
            ->children()
32 1
            ->arrayNode('connections')
33
            ->canBeUnset()
34
            ->prototype('array')
35 1
            ->children()
36 1
            ->scalarNode('protocol')->defaultValue('http')->end()
37 1
            ->scalarNode('host')->defaultValue('127.0.0.1')->end()
38 1
            ->scalarNode('path')->defaultValue('/publish')->end()
39 1
            ->scalarNode('port')->defaultValue(8080)->end()
40 1
            ->scalarNode('auth_secret')->defaultValue(null)->end()
41 1
            ->scalarNode('auth_key')->defaultValue(null)->end()
42 1
            ->scalarNode('hostname')->defaultValue(null)->end()
43 1
            ->booleanNode('ssl_ignore')->defaultFalse()->end()
44 1
            ->end()
45 1
            ->end()
46 1
            ->end()
47 1
            ->end();
48 1
    }
49
}
50