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

getContainerExtension()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

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