Completed
Pull Request — master (#1)
by Rafał
03:36 queued 01:22
created

Configuration   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 45
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B getConfigTreeBuilder() 0 39 1
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
                                    ->isRequired()
45
                                    ->cannotBeEmpty()
46
                                    ->info('Route base paths names')
47
                                ->end()
48
                                ->scalarNode('content_basepath')
49
                                    ->isRequired()
50
                                    ->info('Content base path name')
51
                                ->end()
52
                                ->scalarNode('site_document_class')
53
                                    ->defaultValue('SWP\MultiTenancyBundle\Document\Site')
54
                                    ->info('Site document class, represents current site/tenant in PHPCR tree')
55
                                ->end()
56
                                ->scalarNode('tenant_aware_router_class')
57
                                    ->defaultValue('SWP\MultiTenancyBundle\Routing\TenantAwareRouter')
58
                                    ->info('Tenant aware router class namespace')
59
                                ->end()
60
                            ->end()
61
                        ->end()
62
                    ->end()
63
                ->end()
64
            ->end();
65
66
        return $treeBuilder;
67
    }
68
}
69