Completed
Branch develop (3818c9)
by Baptiste
01:21
created

CloseListener   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 22
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getSubscribedEvents() 0 7 1
A close() 0 4 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\AMQPBundle\EventListener;
5
6
use Innmind\AMQP\Client;
7
use Symfony\Component\{
8
    EventDispatcher\EventSubscriberInterface,
9
    HttpKernel\KernelEvents,
10
    Console\ConsoleEvents
11
};
12
13
final class CloseListener implements EventSubscriberInterface
14
{
15
    private $client;
16
17 4
    public function __construct(Client $client)
18
    {
19 4
        $this->client = $client;
20 4
    }
21
22 2
    public static function getSubscribedEvents(): array
23
    {
24
        return [
25 2
            KernelEvents::TERMINATE => 'close',
26 2
            ConsoleEvents::TERMINATE => 'close',
27
        ];
28
    }
29
30 2
    public function close(): void
31
    {
32 2
        $this->client->close();
33 2
    }
34
}
35