Completed
Pull Request — master (#1)
by Rafał
02:55
created

Configuration::getConfigTreeBuilder()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 38
Code Lines 35

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 38
rs 8.8571
cc 1
eloc 35
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of the Superdesk Web Publisher MultiTenancy 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\MultiTenancyBundle\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
        $treeBuilder->root('swp_multi_tenancy')
33
            ->children()
34
                ->arrayNode('persistence')
35
                    ->addDefaultsIfNotSet()
36
                    ->children()
37
                        ->arrayNode('phpcr')
38
                            ->addDefaultsIfNotSet()
39
                            ->canBeEnabled()
40
                            ->children()
41
                                ->scalarNode('basepath')->defaultValue('/swp')->end()
42
                                ->arrayNode('route_basepaths')
43
                                    ->prototype('scalar')->end()
44
                                    ->defaultValue(['routes'])
45
                                    ->info('Route base paths names')
46
                                ->end()
47
                                ->scalarNode('content_basepath')
48
                                    ->defaultValue('content')
49
                                    ->info('Content base path name')
50
                                ->end()
51
                                ->scalarNode('site_document_class')
52
                                    ->defaultValue('SWP\MultiTenancyBundle\Document\Site')
53
                                    ->info('Site document class, represents current site/tenant in PHPCR tree')
54
                                ->end()
55
                                ->scalarNode('tenant_aware_router_class')
56
                                    ->defaultValue('SWP\MultiTenancyBundle\Routing\TenantAwareRouter')
57
                                    ->info('Tenant aware router FQCN')
58
                                ->end()
59
                            ->end()
60
                        ->end()
61
                    ->end()
62
                ->end()
63
            ->end();
64
65
        return $treeBuilder;
66
    }
67
}
68