Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 39
ccs 28
cts 28
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 33 1
1
<?php
2
/**
3
 * Narrator Bundle
4
 *
5
 * @link      http://github.com/mleko/narrator-bundle
6
 * @copyright Copyright (c) 2017 Daniel Król
7
 * @license   MIT
8
 */
9
10
11
namespace Mleko\Narrator\Bundle\DependencyInjection;
12
13
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
14
use Symfony\Component\Config\Definition\ConfigurationInterface;
15
16
/**
17
 * This is the class that validates and merges configuration from your app/config files
18
 *
19
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
20
 */
21
class Configuration implements ConfigurationInterface
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26 5
    public function getConfigTreeBuilder()
27
    {
28 5
        $treeBuilder = new TreeBuilder();
29 5
        $rootNode = $treeBuilder->root('narrator');
0 ignored issues
show
Deprecated Code introduced by
The method Symfony\Component\Config...der\TreeBuilder::root() has been deprecated with message: since Symfony 4.3, pass the root name to the constructor instead

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
30
31
        $rootNode
32 5
            ->children()
33 5
                ->arrayNode('event_bus')
34 5
                ->defaultValue(['default' => ['resolver' => ['type' => 'name', "name_extractor" => "narrator.name_extractor.class_name"], 'public' => false]])
35 5
                ->requiresAtLeastOneElement()
36 5
                ->useAttributeAsKey('name')
37 5
                ->prototype("array")
38 5
                ->children()
39 5
                    ->booleanNode('public')
40 5
                        ->defaultValue(false)
41 5
                    ->end()
42 5
                    ->arrayNode('resolver')
43 5
                        ->children()
44 5
                            ->enumNode('type')
45 5
                            ->values(['name', 'instanceof', 'service'])
46 5
                            ->isRequired()
47 5
                        ->end()
48 5
                            ->scalarNode('name_extractor')
49 5
                            ->defaultValue("narrator.name_extractor.class_name")
50 5
                        ->end()
51 5
                            ->scalarNode('service_id')
52 5
                        ->end()
53 5
                    ->end()
54 5
                ->end()
55 5
            ->end();
56
57 5
        return $treeBuilder;
58
    }
59
}
60