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.

Channel::queue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\AMQP\Client\Channel;
5
6
use Innmind\AMQP\{
7
    Client\Channel as ChannelInterfce,
8
    Model\Channel\Close,
9
    Transport\Connection,
10
    Transport\Frame\Channel as Number,
11
};
12
13
final class Channel implements ChannelInterfce
14
{
15
    private $connection;
16
    private $number;
17
    private $exchange;
18
    private $queue;
19
    private $basic;
20
    private $transaction;
21
    private $closed = false;
22
23 8
    public function __construct(Connection $connection, Number $number)
24
    {
25 8
        $this->connection = $connection;
26 8
        $this->number = $number;
27
28
        $connection
29 8
            ->send($connection->protocol()->channel()->open($number))
30 8
            ->wait('channel.open-ok');
31
32 8
        $this->exchange = new Exchange\Exchange($connection, $number);
33 8
        $this->queue = new Queue\Queue($connection, $number);
34 8
        $this->basic = new Basic\Basic($connection, $number);
35 8
        $this->transaction = new Transaction\Transaction($connection, $number);
36 8
    }
37
38 2
    public function exchange(): Exchange
39
    {
40 2
        return $this->exchange;
41
    }
42
43 2
    public function queue(): Queue
44
    {
45 2
        return $this->queue;
46
    }
47
48 2
    public function basic(): Basic
49
    {
50 2
        return $this->basic;
51
    }
52
53 2
    public function transaction(): Transaction
54
    {
55 2
        return $this->transaction;
56
    }
57
58 6
    public function closed(): bool
59
    {
60 6
        return $this->closed || $this->connection->closed();
61
    }
62
63 4
    public function close(): void
64
    {
65 4
        if ($this->closed()) {
66 2
            return;
67
        }
68
69
        $this
70 4
            ->connection
71 4
            ->send($this->connection->protocol()->channel()->close(
72 4
                $this->number,
73 4
                new Close
74
            ))
75 4
            ->wait('channel.close-ok');
76 4
        $this->closed = true;
77 4
    }
78
}
79