Configuration::addHttpClientSection()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 11
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Core23\PiwikBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
15
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
16
use Symfony\Component\Config\Definition\ConfigurationInterface;
17
18
final class Configuration implements ConfigurationInterface
19
{
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function getConfigTreeBuilder()
24
    {
25
        $treeBuilder = new TreeBuilder();
26
27
        /** @var ArrayNodeDefinition $node */
28
        $node = $treeBuilder->root('core23_piwik');
29
30
        $this->addHttpClientSection($node);
31
32
        return $treeBuilder;
33
    }
34
35
    /**
36
     * @param ArrayNodeDefinition $node
37
     */
38
    private function addHttpClientSection(ArrayNodeDefinition $node): void
39
    {
40
        $node
41
            ->children()
42
                ->arrayNode('http')
43
                    ->addDefaultsIfNotSet()
44
                    ->children()
45
                        ->scalarNode('client')->defaultValue('httplug.client.default')->end()
46
                        ->scalarNode('message_factory')->defaultValue('httplug.message_factory.default')->end()
47
                    ->end()
48
                ->end()
49
            ->end()
50
        ;
51
    }
52
}
53