Completed
Pull Request — master (#2)
by Alessandro
10:56 queued 01:02
created

Configuration   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 42
ccs 25
cts 25
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 8 1
A addConnections() 0 22 1
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
     * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder
19
     */
20
    public function getConfigTreeBuilder()
21 1
    {
22
        $tree = new TreeBuilder();
23 1
        $rootNode = $tree->root('facile_crossbar_http_publisher');
24 1
        $this->addConnections($rootNode);
25 1
26 1
        return $tree;
27
    }
28
29
    /**
30
     * @param ArrayNodeDefinition $node
31
     */
32 1
    protected function addConnections(ArrayNodeDefinition $node)
33
    {
34
        $node
35 1
            ->fixXmlConfig('connection')
36 1
            ->children()
37 1
            ->arrayNode('connections')
38 1
            ->canBeUnset()
39 1
            ->prototype('array')
40 1
            ->children()
41 1
            ->scalarNode('protocol')->defaultValue('http')->end()
42 1
            ->scalarNode('host')->defaultValue('127.0.0.1')->end()
43 1
            ->scalarNode('path')->defaultValue('/publish')->end()
44 1
            ->scalarNode('port')->defaultValue(8080)->end()
45 1
            ->scalarNode('auth_secret')->defaultValue(null)->end()
46 1
            ->scalarNode('auth_key')->defaultValue(null)->end()
47 1
            ->scalarNode('hostname')->defaultValue(null)->end()
48 1
            ->booleanNode('ssl_ignore')->defaultFalse()->end()
49 1
            ->end()
50 1
            ->end()
51 1
            ->end()
52 1
            ->end();
53
    }
54
}
55