GendoriaCommandQueueBundle::build()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
ccs 6
cts 6
cp 1
rs 9.4285
cc 1
eloc 5
nc 1
nop 1
crap 1
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 Gendoria\CommandQueueBundle\DependencyInjection\Pass\RegisterSerializerDriversPass;
9
use Gendoria\CommandQueueBundle\DependencyInjection\Pass\WorkerRunnersPass;
10
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
11
use Symfony\Component\DependencyInjection\ContainerBuilder;
12
use Symfony\Component\HttpKernel\Bundle\Bundle;
13
14
/**
15
 * Command queue bundle.
16
 *
17
 * @author Tomasz Struczyński <[email protected]>
18
 */
19
class GendoriaCommandQueueBundle extends Bundle
20
{
21
    /**
22
     * Get default extension class instance.
23
     *
24
     * @return GendoriaCommandQueueExtension
25
     */
26 1
    public function getContainerExtension()
27
    {
28 1
        if (null === $this->extension || false === $this->extension) {
29 1
            $this->extension = new GendoriaCommandQueueExtension();
30 1
        }
31
32 1
        return $this->extension;
33
    }
34
35
    /**
36
     * Build bundle.
37
     *
38
     * During build, two compile passes are registered: for fetching command processors and pool configurations.
39
     *
40
     * @param ContainerBuilder $container Container builder.
41
     */
42 1
    public function build(ContainerBuilder $container)
43
    {
44 1
        $container->addCompilerPass(new CommandProcessorPass(), PassConfig::TYPE_BEFORE_REMOVING);
45 1
        $container->addCompilerPass(new PoolsPass());
46 1
        $container->addCompilerPass(new RegisterSerializerDriversPass());
47 1
        $container->addCompilerPass(new WorkerRunnersPass());
48 1
    }
49
}
50