Configuration::getConfigTreeBuilder()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 37
Code Lines 32

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 2
Metric Value
cc 1
eloc 32
c 2
b 0
f 2
nc 1
nop 0
dl 0
loc 37
rs 8.8571
1
<?php
2
3
/**
4
 * This file is part of the Superdesk Web Publisher Updater Bundle.
5
 *
6
 * Copyright 2015 Sourcefabric z.u. and contributors.
7
 *
8
 * For the full copyright and license information, please see the
9
 * AUTHORS and LICENSE files distributed with this source code.
10
 *
11
 * @copyright 2015 Sourcefabric z.ú.
12
 * @license http://www.superdesk.org/license
13
 */
14
namespace SWP\UpdaterBundle\DependencyInjection;
15
16
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
17
use Symfony\Component\Config\Definition\ConfigurationInterface;
18
19
/**
20
 * This is the class that validates and merges configuration from your app/config files.
21
 *
22
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
23
 */
24
class Configuration implements ConfigurationInterface
25
{
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function getConfigTreeBuilder()
30
    {
31
        $treeBuilder = new TreeBuilder();
32
        $rootNode = $treeBuilder->root('swp_updater', 'array');
33
34
        $rootNode
35
            ->children()
36
                ->scalarNode('version_class')
37
                    ->isRequired()
38
                    ->cannotBeEmpty()
39
                ->end()
40
                ->scalarNode('temp_dir')
41
                    ->defaultValue('default')
42
                ->end()
43
                ->booleanNode('monolog_channel')
44
                    ->defaultFalse()
45
                ->end()
46
                ->scalarNode('target_dir')
47
                    ->defaultValue('default')
48
                ->end()
49
                ->arrayNode('client')
50
                    ->addDefaultsIfNotSet()
51
                    ->children()
52
                        ->scalarNode('base_uri')
53
                            ->cannotBeEmpty()
54
                            ->isRequired()
55
                        ->end()
56
                        ->scalarNode('type')
57
                            ->defaultValue('default')
58
                        ->end()
59
                    ->end()
60
                ->end()
61
            ->end()
62
        ;
63
64
        return $treeBuilder;
65
    }
66
}
67