Completed
Pull Request — master (#4433)
by Craig
04:30
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 16
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 21
rs 9.7333
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Zikula package.
7
 *
8
 * Copyright Zikula - https://ziku.la/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Zikula\Bundle\CoreBundle\DependencyInjection;
15
16
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
17
use Symfony\Component\Config\Definition\ConfigurationInterface;
18
19
class Configuration implements ConfigurationInterface
20
{
21
    public const DEFAULT_DATADIR = 'public/uploads';
22
23
    public function getConfigTreeBuilder()
24
    {
25
        $treeBuilder = new TreeBuilder('core');
26
27
        $treeBuilder->getRootNode()
28
            ->children()
29
                ->scalarNode('datadir')->defaultValue(self::DEFAULT_DATADIR)->end()
30
                ->scalarNode('maker_root_namespace')->defaultNull()->end()
31
                ->arrayNode('multisites')
32
                    ->addDefaultsIfNotSet()
33
                    ->children()
34
                        ->booleanNode('enabled')->defaultFalse()->end()
35
                        ->scalarNode('mainsiteurl')->defaultNull()->end()
36
                        ->scalarNode('based_on_domains')->defaultNull()->end()
37
                        ->arrayNode('protected_systemvars')->addDefaultsIfNotSet()->end()
38
                    ->end()
39
                ->end() // multisites
40
            ->end()
41
        ;
42
43
        return $treeBuilder;
44
    }
45
}
46