SocketIoConfiguration   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 38
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 14 2
A addNamespaces() 0 12 1
1
<?php
2
3
namespace SfCod\SocketIoBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
6
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
7
use Symfony\Component\Config\Definition\ConfigurationInterface;
8
use Symfony\Component\HttpKernel\Kernel;
9
10
/**
11
 * Class SocketIoConfiguration.
12
 *
13
 * @author Virchenko Maksim <[email protected]>
14
 *
15
 * @package SfCod\SocketIoBundle\DependencyInjection
16
 */
17
class SocketIoConfiguration implements ConfigurationInterface
18
{
19
    /**
20
     * Generates the configuration tree builder.
21
     *
22
     * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder
23
     */
24
    public function getConfigTreeBuilder()
25
    {
26
        if (Kernel::VERSION_ID >= 40300) {
27
            $treeBuilder = new TreeBuilder('sfcod_socketio');
28
            $rootNode = $treeBuilder->getRootNode();
29
        } else {
30
            $treeBuilder = new TreeBuilder();
0 ignored issues
show
Bug introduced by
The call to TreeBuilder::__construct() misses a required argument $name.

This check looks for function calls that miss required arguments.

Loading history...
31
            $rootNode = $treeBuilder->root('sfcod_socketio');
0 ignored issues
show
Bug introduced by
The method root() does not seem to exist on object<Symfony\Component...on\Builder\TreeBuilder>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
32
        }
33
34
        $this->addNamespaces($rootNode);
35
36
        return $treeBuilder;
37
    }
38
39
    /**
40
     * Add namespaces.
41
     */
42
    private function addNamespaces(ArrayNodeDefinition $rootNode)
43
    {
44
        $rootNode
45
            ->children()
46
                ->arrayNode('namespaces')
47
                    ->scalarPrototype()->end()
48
                ->end()
49
                ->arrayNode('processMiddlewares')
50
                    ->scalarPrototype()->end()
51
                ->end()
52
            ->end();
53
    }
54
}
55