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

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 15
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 20
rs 9.7666
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
                ->arrayNode('multisites')
31
                    ->addDefaultsIfNotSet()
32
                    ->children()
33
                        ->booleanNode('enabled')->defaultFalse()->end()
34
                        ->scalarNode('mainsiteurl')->defaultNull()->end()
35
                        ->scalarNode('based_on_domains')->defaultNull()->end()
36
                        ->arrayNode('protected_systemvars')->addDefaultsIfNotSet()->end()
37
                    ->end()
38
                ->end() // multisites
39
            ->end()
40
        ;
41
42
        return $treeBuilder;
43
    }
44
}
45