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

Queue::__invoke()   B

Complexity

Conditions 6
Paths 6

Size

Total Lines 29
Code Lines 20

Duplication

Lines 29
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 31.2848

Importance

Changes 0
Metric Value
dl 29
loc 29
ccs 2
cts 18
cp 0.1111
rs 8.439
c 0
b 0
f 0
cc 6
eloc 20
nc 6
nop 2
crap 31.2848
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\ShortString,
10
    Transport\Frame\Value\UnsignedLongInteger,
11
    Transport\Protocol\v091\Methods,
12
    Exception\UnknownMethod
13
};
14
use Innmind\Immutable\{
15
    Str,
16
    StreamInterface
17
};
18
19 View Code Duplication
final class Queue
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
{
21
    /**
22
     * @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...
23
     */
24 1
    public function __invoke(Method $method, Str $arguments): StreamInterface
25
    {
26
        switch (true) {
27 1
            case Methods::get('queue.declare-ok')->equals($method):
28
                $visit = $this->declareOk();
29
                break;
30
31
            case Methods::get('queue.bind-ok')->equals($method):
32
                $visit = $this->bindOk();
33
                break;
34
35
            case Methods::get('queue.unbind-ok')->equals($method):
36
                $visit = $this->unbindOk();
37
                break;
38
39
            case Methods::get('queue.purge-ok')->equals($method):
40
                $visit = $this->purgeOk();
41
                break;
42
43
            case Methods::get('queue.delete-ok')->equals($method):
44
                $visit = $this->deleteOk();
45
                break;
46
47
            default:
48
                throw new UnknownMethod($method);
49
        }
50
51
        return $visit($arguments);
52
    }
53
54
    private function declareOk(): Arguments
55
    {
56
        return new Arguments(
57
            ShortString::class, //queue
58
            UnsignedLongInteger::class, //message count
59
            UnsignedLongInteger::class //consumer count
60
        );
61
    }
62
63
    private function bindOk(): Arguments
64
    {
65
        return new Arguments; //no arguments
66
    }
67
68
    private function unbindOk(): Arguments
69
    {
70
        return new Arguments; //no arguments
71
    }
72
73
    private function purgeOk(): Arguments
74
    {
75
        return new Arguments(
76
            UnsignedLongInteger::class //message count
77
        );
78
    }
79
80
    private function deleteOk(): Arguments
81
    {
82
        return new Arguments(
83
            UnsignedLongInteger::class //message count
84
        );
85
    }
86
}
87