Configuration::getConfigTreeBuilder()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 30
Code Lines 27

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 30
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 27
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the MilioooMessageBundle package.
5
 *
6
 * (c) Michiel boeckaert <[email protected]>
7
 * This source file is subject to the MIT license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace Miliooo\MessagingBundle\DependencyInjection;
12
13
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
14
use Symfony\Component\Config\Definition\ConfigurationInterface;
15
16
/**
17
 * This class contains the configuration information for the bundle.
18
 *
19
 * @author Michiel Boeckaert <[email protected]>
20
 */
21
class Configuration implements ConfigurationInterface
22
{
23
    /**
24
     * {@inheritDoc}
25
     */
26
    public function getConfigTreeBuilder()
27
    {
28
        $treeBuilder = new TreeBuilder();
29
        $rootNode = $treeBuilder->root('miliooo_messaging');
30
        $rootNode
31
            ->children()
32
            ->scalarNode('thread_class')->isRequired()->cannotBeEmpty()->end()
33
            ->scalarNode('thread_meta_class')->isRequired()->cannotBeEmpty()->end()
34
            ->scalarNode('message_class')->isRequired()->cannotBeEmpty()->end()
35
            ->scalarNode('message_meta_class')->isRequired()->cannotBeEmpty()->end()
36
            ->scalarNode('username_object_transformer')->isRequired()->cannotBeEmpty()->end()
37
            ->scalarNode('participant_provider')->defaultValue('miliooo_messaging.participant_provider.default')->cannotBeEmpty()->end()
38
            ->arrayNode('new_thread_form')
39
                ->addDefaultsIfNotSet()
40
                ->children()
41
                    ->scalarNode('factory')->defaultValue('miliooo_messaging.new_thread_form.factory.default')->cannotBeEmpty()->end()
42
                    ->scalarNode('model')->defaultValue('Miliooo\Messaging\Form\FormModel\NewThreadSingleRecipient')->cannotBeEmpty()->end()
43
                    ->scalarNode('type')->defaultValue('miliooo_messaging.new_thread_form.type.default')->cannotBeEmpty()->end()
44
                ->end()
45
            ->end()
46
            ->arrayNode('specification')
47
                ->addDefaultsIfNotSet()
48
                ->children()
49
                    ->scalarNode('can_message_recipient')->defaultValue('miliooo_messaging.specification.can_message_recipient.default')->cannotBeEmpty()->end()
50
                ->end()
51
            ->end()
52
        ->end();
53
54
        return $treeBuilder;
55
    }
56
}
57