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 ( 0ca8df...abdfad )
by Baptiste
03:43
created

Logger   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Test Coverage

Coverage 93.94%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 6
dl 0
loc 74
ccs 31
cts 33
cp 0.9394
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A protocol() 0 4 1
A send() 0 17 1
A wait() 0 15 1
A maxFrameSize() 0 4 1
A close() 0 5 1
A closed() 0 4 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
                'binary' => (string) $frame,
44 2
                'uuid' => $uuid = (string) Uuid::uuid4(),
45
            ]
46
        );
47
48 2
        $this->connection->send($frame);
49 2
        $this->logger->debug('AMQP frame sent', ['uuid' => $uuid]);
50
51 2
        return $this;
52
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57 2
    public function wait(string ...$names): Frame
58
    {
59 2
        $this->logger->debug('Waiting for AMQP frame', ['names' => $names]);
60 2
        $frame = $this->connection->wait(...$names);
61 2
        $this->logger->debug(
62 2
            'AMQP frame received',
63
            [
64 2
                'type' => $frame->type()->toInt(),
65 2
                'channel' => $frame->channel()->toInt(),
66 2
                'binary' => (string) $frame,
67
            ]
68
        );
69
70 2
        return $frame;
71
    }
72
73
    public function maxFrameSize(): MaxFrameSize
74
    {
75
        return $this->connection->maxFrameSize();
76
    }
77
78 2
    public function close(): void
79
    {
80 2
        $this->connection->close();
81 2
        $this->logger->debug('AMQP connection closed');
82 2
    }
83
84 2
    public function closed(): bool
85
    {
86 2
        return $this->connection->closed();
87
    }
88
}
89