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 — develop ( faae32...638f88 )
by Baptiste
03:29
created

Basic   A

Complexity

Total Complexity 17

Size/Duplication

Total Lines 108
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 3.39%

Importance

Changes 0
Metric Value
wmc 17
lcom 0
cbo 2
dl 0
loc 108
ccs 2
cts 59
cp 0.0339
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
D __invoke() 0 41 9
A qosOk() 0 4 1
A consumeOk() 0 6 1
A cancelOk() 0 6 1
A return() 0 9 1
A deliver() 0 10 1
A getOk() 0 10 1
A getEmpty() 0 4 1
A recoverOk() 0 4 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\Arguments,
9
    Transport\Frame\Value\Bits,
10
    Transport\Frame\Value\ShortString,
11
    Transport\Frame\Value\UnsignedLongInteger,
12
    Transport\Frame\Value\UnsignedLongLongInteger,
13
    Transport\Frame\Value\UnsignedShortInteger,
14
    Transport\Protocol\v091\Methods,
15
    Exception\UnknownMethod
16
};
17
use Innmind\Immutable\{
18
    Str,
19
    StreamInterface
20
};
21
22
final class Basic
23
{
24
    /**
25
     * @return StreamInterface<Value>
0 ignored issues
show
Documentation introduced by
The doc-type StreamInterface<Value> could not be parsed: Expected "|" or "end of type", but got "<" at position 15. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
26
     */
27 1
    public function __invoke(Method $method, Str $arguments): StreamInterface
28
    {
29
        switch (true) {
30 1
            case Methods::get('basic.qos-ok')->equals($method):
31
                $visit = $this->qosOk();
32
                break;
33
34
            case Methods::get('basic.consume-ok')->equals($method):
35
                $visit = $this->consumeOk();
36
                break;
37
38
            case Methods::get('basic.cancel-ok')->equals($method):
39
                $visit = $this->cancelOk();
40
                break;
41
42
            case Methods::get('basic.return')->equals($method):
43
                $visit = $this->return();
44
                break;
45
46
            case Methods::get('basic.deliver')->equals($method):
47
                $visit = $this->deliver();
48
                break;
49
50
            case Methods::get('basic.get-ok')->equals($method):
51
                $visit = $this->getOk();
52
                break;
53
54
            case Methods::get('basic.get-empty')->equals($method):
55
                $visit = $this->getEmpty();
56
                break;
57
58
            case Methods::get('basic.recover-ok')->equals($method):
59
                $visit = $this->recoverOk();
60
                break;
61
62
            default:
63
                throw new UnknownMethod($method);
64
        }
65
66
        return $visit($arguments);
67
    }
68
69
    private function qosOk(): Arguments
70
    {
71
        return new Arguments; //no arguments
72
    }
73
74
    private function consumeOk(): Arguments
75
    {
76
        return new Arguments(
77
            ShortString::class //consumer tag
78
        );
79
    }
80
81
    private function cancelOk(): Arguments
82
    {
83
        return new Arguments(
84
            ShortString::class //consumer tag
85
        );
86
    }
87
88
    private function return(): Arguments
89
    {
90
        return new Arguments(
91
            UnsignedShortInteger::class, //reply code
92
            ShortString::class, //reply text
93
            ShortString::class, //exchange
94
            ShortString::class //routing key
95
        );
96
    }
97
98
    private function deliver(): Arguments
99
    {
100
        return new Arguments(
101
            ShortString::class, //consumer tag
102
            UnsignedLongLongInteger::class, //delivery tag
103
            Bits::class, //redelivered
104
            ShortString::class, //exchange
105
            ShortString::class //routing key
106
        );
107
    }
108
109
    private function getOk(): Arguments
110
    {
111
        return new Arguments(
112
            UnsignedLongLongInteger::class, //delivery tag
113
            Bits::class, //redelivered
114
            ShortString::class, //exchange
115
            ShortString::class, //routing key
116
            UnsignedLongInteger::class //message count
117
        );
118
    }
119
120
    private function getEmpty(): Arguments
121
    {
122
        return new Arguments; //no arguments
123
    }
124
125
    private function recoverOk(): Arguments
126
    {
127
        return new Arguments; //no arguments
128
    }
129
}
130