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 ( 638f88...e189ab )
by Baptiste
01:40
created

Basic   A

Complexity

Total Complexity 17

Size/Duplication

Total Lines 108
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 17
lcom 0
cbo 4
dl 0
loc 108
ccs 59
cts 59
cp 1
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 17
    public function __invoke(Method $method, Str $arguments): StreamInterface
28
    {
29
        switch (true) {
30 17
            case Methods::get('basic.qos-ok')->equals($method):
1 ignored issue
show
Documentation introduced by
$method is of type object<Innmind\AMQP\Transport\Frame\Method>, but the function expects a object<self>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
31 2
                $visit = $this->qosOk();
32 2
                break;
33
34 15
            case Methods::get('basic.consume-ok')->equals($method):
1 ignored issue
show
Documentation introduced by
$method is of type object<Innmind\AMQP\Transport\Frame\Method>, but the function expects a object<self>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
35 2
                $visit = $this->consumeOk();
36 2
                break;
37
38 13
            case Methods::get('basic.cancel-ok')->equals($method):
1 ignored issue
show
Documentation introduced by
$method is of type object<Innmind\AMQP\Transport\Frame\Method>, but the function expects a object<self>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
39 2
                $visit = $this->cancelOk();
40 2
                break;
41
42 11
            case Methods::get('basic.return')->equals($method):
1 ignored issue
show
Documentation introduced by
$method is of type object<Innmind\AMQP\Transport\Frame\Method>, but the function expects a object<self>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
43 2
                $visit = $this->return();
44 2
                break;
45
46 9
            case Methods::get('basic.deliver')->equals($method):
1 ignored issue
show
Documentation introduced by
$method is of type object<Innmind\AMQP\Transport\Frame\Method>, but the function expects a object<self>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
47 2
                $visit = $this->deliver();
48 2
                break;
49
50 7
            case Methods::get('basic.get-ok')->equals($method):
1 ignored issue
show
Documentation introduced by
$method is of type object<Innmind\AMQP\Transport\Frame\Method>, but the function expects a object<self>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
51 2
                $visit = $this->getOk();
52 2
                break;
53
54 5
            case Methods::get('basic.get-empty')->equals($method):
1 ignored issue
show
Documentation introduced by
$method is of type object<Innmind\AMQP\Transport\Frame\Method>, but the function expects a object<self>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
55 2
                $visit = $this->getEmpty();
56 2
                break;
57
58 3
            case Methods::get('basic.recover-ok')->equals($method):
1 ignored issue
show
Documentation introduced by
$method is of type object<Innmind\AMQP\Transport\Frame\Method>, but the function expects a object<self>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
59 2
                $visit = $this->recoverOk();
60 2
                break;
61
62
            default:
63 1
                throw new UnknownMethod($method);
64
        }
65
66 16
        return $visit($arguments);
67
    }
68
69 2
    private function qosOk(): Arguments
70
    {
71 2
        return new Arguments; //no arguments
72
    }
73
74 2
    private function consumeOk(): Arguments
75
    {
76 2
        return new Arguments(
77 2
            ShortString::class //consumer tag
78
        );
79
    }
80
81 2
    private function cancelOk(): Arguments
82
    {
83 2
        return new Arguments(
84 2
            ShortString::class //consumer tag
85
        );
86
    }
87
88 2
    private function return(): Arguments
89
    {
90 2
        return new Arguments(
91 2
            UnsignedShortInteger::class, //reply code
92 2
            ShortString::class, //reply text
93 2
            ShortString::class, //exchange
94 2
            ShortString::class //routing key
95
        );
96
    }
97
98 2
    private function deliver(): Arguments
99
    {
100 2
        return new Arguments(
101 2
            ShortString::class, //consumer tag
102 2
            UnsignedLongLongInteger::class, //delivery tag
103 2
            Bits::class, //redelivered
104 2
            ShortString::class, //exchange
105 2
            ShortString::class //routing key
106
        );
107
    }
108
109 2
    private function getOk(): Arguments
110
    {
111 2
        return new Arguments(
112 2
            UnsignedLongLongInteger::class, //delivery tag
113 2
            Bits::class, //redelivered
114 2
            ShortString::class, //exchange
115 2
            ShortString::class, //routing key
116 2
            UnsignedLongInteger::class //message count
117
        );
118
    }
119
120 2
    private function getEmpty(): Arguments
121
    {
122 2
        return new Arguments; //no arguments
123
    }
124
125 2
    private function recoverOk(): Arguments
126
    {
127 2
        return new Arguments; //no arguments
128
    }
129
}
130