OldSoundRabbitMqBundle   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 1 Features 0
Metric Value
eloc 12
c 3
b 1
f 0
dl 0
loc 24
ccs 0
cts 12
cp 0
rs 10
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A shutdown() 0 10 4
A build() 0 7 1
1
<?php
2
3
namespace OldSound\RabbitMqBundle;
4
5
use OldSound\RabbitMqBundle\DependencyInjection\Compiler\InjectEventDispatcherPass;
6
use OldSound\RabbitMqBundle\DependencyInjection\Compiler\RegisterPartsPass;
7
use OldSound\RabbitMqBundle\DependencyInjection\Compiler\ServiceContainerPass;
8
use Symfony\Component\HttpKernel\Bundle\Bundle;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
11
class OldSoundRabbitMqBundle extends Bundle
12
{
13
    public function build(ContainerBuilder $container): void
14
    {
15
        parent::build($container);
16
17
        $container->addCompilerPass(new RegisterPartsPass());
18
        $container->addCompilerPass(new InjectEventDispatcherPass());
19
        $container->addCompilerPass(new ServiceContainerPass());
20
    }
21
22
    /**
23
     * {@inheritDoc}
24
     */
25
    public function shutdown(): void
26
    {
27
        parent::shutdown();
28
        if (!$this->container->hasParameter('old_sound_rabbit_mq.base_amqp')) {
29
            return;
30
        }
31
        $connections = $this->container->getParameter('old_sound_rabbit_mq.base_amqp');
32
        foreach ($connections as $connection) {
33
            if ($this->container->initialized($connection)) {
34
                $this->container->get($connection)->close();
35
            }
36
        }
37
    }
38
}
39