GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( abdfad...3e12fc )
by Baptiste
03:10 queued 01:17
created

Logger   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Test Coverage

Coverage 93.55%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 6
dl 0
loc 72
ccs 29
cts 31
cp 0.9355
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A maxFrameSize() 0 4 1
A close() 0 5 1
A closed() 0 4 1
A __construct() 0 7 1
A protocol() 0 4 1
A send() 0 16 1
A wait() 0 14 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\AMQP\Transport\Connection;
5
6
use Innmind\AMQP\{
7
    Transport\Connection as ConnectionInterface,
8
    Transport\Protocol,
9
    Transport\Frame,
10
    Model\Connection\MaxFrameSize
11
};
12
use Ramsey\Uuid\Uuid;
13
use Psr\Log\LoggerInterface;
14
15
final class Logger implements ConnectionInterface
16
{
17
    private $connection;
18
    private $logger;
19
20 12
    public function __construct(
21
        ConnectionInterface $connection,
22
        LoggerInterface $logger
23
    ) {
24 12
        $this->connection = $connection;
25 12
        $this->logger = $logger;
26 12
    }
27
28 2
    public function protocol(): Protocol
29
    {
30 2
        return $this->connection->protocol();
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 2
    public function send(Frame $frame): ConnectionInterface
37
    {
38 2
        $this->logger->debug(
39 2
            'AMQP frame about to be sent',
40
            [
41 2
                'type' => $frame->type()->toInt(),
42 2
                'channel' => $frame->channel()->toInt(),
43 2
                'uuid' => $uuid = (string) Uuid::uuid4(),
44
            ]
45
        );
46
47 2
        $this->connection->send($frame);
48 2
        $this->logger->debug('AMQP frame sent', ['uuid' => $uuid]);
49
50 2
        return $this;
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56 2
    public function wait(string ...$names): Frame
57
    {
58 2
        $this->logger->debug('Waiting for AMQP frame', ['names' => $names]);
59 2
        $frame = $this->connection->wait(...$names);
60 2
        $this->logger->debug(
61 2
            'AMQP frame received',
62
            [
63 2
                'type' => $frame->type()->toInt(),
64 2
                'channel' => $frame->channel()->toInt(),
65
            ]
66
        );
67
68 2
        return $frame;
69
    }
70
71
    public function maxFrameSize(): MaxFrameSize
72
    {
73
        return $this->connection->maxFrameSize();
74
    }
75
76 2
    public function close(): void
77
    {
78 2
        $this->connection->close();
79 2
        $this->logger->debug('AMQP connection closed');
80 2
    }
81
82 2
    public function closed(): bool
83
    {
84 2
        return $this->connection->closed();
85
    }
86
}
87