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.

Queue   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 30
dl 0
loc 65
ccs 33
cts 33
cp 1
rs 10
c 0
b 0
f 0
wmc 11

6 Methods

Rating   Name   Duplication   Size   Complexity  
A deleteOk() 0 4 1
A purgeOk() 0 4 1
A bindOk() 0 3 1
A __invoke() 0 28 6
A unbindOk() 0 3 1
A declareOk() 0 6 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\AMQP\Transport\Protocol\v091\Reader;
5
6
use Innmind\AMQP\{
7
    Transport\Frame\Method,
8
    Transport\Frame\Visitor\ChunkArguments,
9
    Transport\Frame\Value\ShortString,
10
    Transport\Frame\Value\UnsignedLongInteger,
11
    Transport\Protocol\v091\Methods,
12
    Exception\UnknownMethod,
13
};
14
use Innmind\Stream\Readable;
15
use Innmind\Immutable\StreamInterface;
16
17
final class Queue
18
{
19
    /**
20
     * @return StreamInterface<Value>
21
     */
22 70
    public function __invoke(Method $method, Readable $arguments): StreamInterface
23
    {
24
        switch (true) {
25 70
            case Methods::get('queue.declare-ok')->equals($method):
26 52
                $chunk = $this->declareOk();
27 52
                break;
28
29 60
            case Methods::get('queue.bind-ok')->equals($method):
30 40
                $chunk = $this->bindOk();
31 40
                break;
32
33 20
            case Methods::get('queue.unbind-ok')->equals($method):
34 6
                $chunk = $this->unbindOk();
35 6
                break;
36
37 14
            case Methods::get('queue.purge-ok')->equals($method):
38 6
                $chunk = $this->purgeOk();
39 6
                break;
40
41 8
            case Methods::get('queue.delete-ok')->equals($method):
42 6
                $chunk = $this->deleteOk();
43 6
                break;
44
45
            default:
46 2
                throw new UnknownMethod($method);
47
        }
48
49 68
        return $chunk($arguments);
50
    }
51
52 52
    private function declareOk(): ChunkArguments
53
    {
54 52
        return new ChunkArguments(
55 52
            ShortString::class, //queue
56 52
            UnsignedLongInteger::class, //message count
57 52
            UnsignedLongInteger::class //consumer count
58
        );
59
    }
60
61 40
    private function bindOk(): ChunkArguments
62
    {
63 40
        return new ChunkArguments; //no arguments
64
    }
65
66 6
    private function unbindOk(): ChunkArguments
67
    {
68 6
        return new ChunkArguments; //no arguments
69
    }
70
71 6
    private function purgeOk(): ChunkArguments
72
    {
73 6
        return new ChunkArguments(
74 6
            UnsignedLongInteger::class //message count
75
        );
76
    }
77
78 6
    private function deleteOk(): ChunkArguments
79
    {
80 6
        return new ChunkArguments(
81 6
            UnsignedLongInteger::class //message count
82
        );
83
    }
84
}
85