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

CloseListener::close()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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