Cancelled
Push — master ( 1c67ad...ddb88a )
by Tomasz
03:20
created

GendoriaCommandQueueBundle   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 55.56%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 5
dl 0
loc 29
ccs 5
cts 9
cp 0.5556
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 5 1
A getContainerExtension() 0 8 3
1
<?php
2
3
namespace Gendoria\CommandQueueBundle;
4
5
use Gendoria\CommandQueueBundle\DependencyInjection\GendoriaCommandQueueExtension;
6
use Gendoria\CommandQueueBundle\DependencyInjection\Pass\CommandProcessorPass;
7
use Gendoria\CommandQueueBundle\DependencyInjection\Pass\PoolsPass;
8
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
use Symfony\Component\HttpKernel\Bundle\Bundle;
11
12
/**
13
 * Command queue bundle.
14
 *
15
 * @author Tomasz Struczyński <[email protected]>
16
 */
17
class GendoriaCommandQueueBundle extends Bundle
18
{
19
    /**
20
     * Get default extension class instance.
21
     *
22
     * @return GendoriaCommandQueueExtension
23
     */
24 1
    public function getContainerExtension()
25
    {
26 1
        if (null === $this->extension || false === $this->extension) {
27 1
            $this->extension = new GendoriaCommandQueueExtension();
28 1
        }
29
30 1
        return $this->extension;
31
    }
32
33
    /**
34
     * Build bundle.
35
     *
36
     * During build, two compile passes are registered: for fetching command processors and pool configurations.
37
     *
38
     * @param ContainerBuilder $container Container builder.
39
     */
40
    public function build(ContainerBuilder $container)
41
    {
42
        $container->addCompilerPass(new CommandProcessorPass(), PassConfig::TYPE_BEFORE_REMOVING);
43
        $container->addCompilerPass(new PoolsPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION);
44
    }
45
}
46