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

GendoriaCommandQueueBundle::build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 4
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 2
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