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 ( dc595a...ae55c1 )
by Baptiste
02:15
created

Basic::reject()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 10
Ratio 100 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
dl 10
loc 10
c 0
b 0
f 0
ccs 7
cts 7
cp 1
rs 9.4285
cc 1
eloc 7
nc 1
nop 2
crap 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\AMQP\Transport\Protocol\v091;
5
6
use Innmind\AMQP\{
7
    Model\Basic\Ack,
8
    Model\Basic\Cancel,
9
    Model\Basic\Consume,
10
    Model\Basic\Get,
11
    Model\Basic\Publish,
12
    Model\Basic\Qos,
13
    Model\Basic\Recover,
14
    Model\Basic\Reject,
15
    Transport\Frame,
16
    Transport\Frame\Type,
17
    Transport\Frame\Channel as FrameChannel,
18
    Transport\Frame\Value,
19
    Transport\Frame\Value\UnsignedLongLongInteger,
20
    Transport\Frame\Value\UnsignedLongInteger,
21
    Transport\Frame\Value\Bits,
22
    Transport\Frame\Value\ShortString,
23
    Transport\Frame\Value\UnsignedShortInteger,
24
    Transport\Frame\Value\Table,
25
    Transport\Protocol\Basic as BasicInterface
26
};
27
use Innmind\Math\Algebra\Integer;
28
use Innmind\Immutable\{
29
    Str,
30
    Map
31
};
32
33
final class Basic implements BasicInterface
34
{
35 1 View Code Duplication
    public function ack(FrameChannel $channel, Ack $command): Frame
0 ignored issues
show
Duplication introduced by
This method 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...
36
    {
37 1
        return new Frame(
38 1
            Type::method(),
39 1
            $channel,
40 1
            Methods::get('basic.ack'),
41 1
            new UnsignedLongLongInteger(new Integer($command->deliveryTag())),
42 1
            new Bits($command->isMultiple())
43
        );
44
    }
45
46 1
    public function cancel(FrameChannel $channel, Cancel $command): Frame
47
    {
48 1
        return new Frame(
49 1
            Type::method(),
50 1
            $channel,
51 1
            Methods::get('basic.cancel'),
52 1
            new ShortString(new Str($command->consumerTag())),
53 1
            new Bits(!$command->shouldWait())
54
        );
55
    }
56
57 1 View Code Duplication
    public function consume(FrameChannel $channel, Consume $command): Frame
0 ignored issues
show
Duplication introduced by
This method 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...
58
    {
59 1
        $consumerTag = '';
60
61 1
        if (!$command->shouldAutoGenerateConsumerTag()) {
62 1
            $consumerTag = $command->consumerTag();
63
        }
64
65 1
        return new Frame(
66 1
            Type::method(),
67 1
            $channel,
68 1
            Methods::get('basic.consume'),
69 1
            new UnsignedShortInteger(new Integer(0)), //ticket (reserved)
70 1
            new ShortString(new Str($command->queue())),
71 1
            new ShortString(new Str($consumerTag)),
72 1
            new Bits(
73 1
                !$command->isLocal(),
74 1
                $command->shouldAutoAcknowledge(),
75 1
                $command->isExclusive(),
76 1
                !$command->shouldWait()
77
            ),
78 1
            new Table(new Map('string', Value::class)) //todo: use $command->arguments()
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
79
        );
80
    }
81
82 1
    public function get(FrameChannel $channel, Get $command): Frame
83
    {
84 1
        return new Frame(
85 1
            Type::method(),
86 1
            $channel,
87 1
            Methods::get('basic.get'),
88 1
            new UnsignedShortInteger(new Integer(0)), //ticket (reserved)
89 1
            new ShortString(new Str($command->queue())),
90 1
            new Bits($command->shouldAutoAcknowledge())
91
        );
92
    }
93
94 1
    public function publish(FrameChannel $channel, Publish $command): Frame
95
    {
96 1
        return new Frame(
97 1
            Type::method(),
98 1
            $channel,
99 1
            Methods::get('basic.publish'),
100 1
            new UnsignedShortInteger(new Integer(0)), //ticket (reserved)
101 1
            new ShortString(new Str($command->exchange())),
102 1
            new ShortString(new Str($command->routingKey())),
103 1
            new Bits(
104 1
                $command->mandatory(),
105 1
                $command->immediate()
106
            )
107
        );
108
    }
109
110 1 View Code Duplication
    public function qos(FrameChannel $channel, Qos $command): Frame
0 ignored issues
show
Duplication introduced by
This method 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...
111
    {
112 1
        return new Frame(
113 1
            Type::method(),
114 1
            $channel,
115 1
            Methods::get('basic.qos'),
116 1
            new UnsignedLongInteger(new Integer($command->prefetchSize())),
117 1
            new UnsignedShortInteger(new Integer($command->prefetchCount())),
118 1
            new Bits($command->isGlobal())
119
        );
120
    }
121
122 1
    public function recover(FrameChannel $channel, Recover $command): Frame
123
    {
124 1
        return new Frame(
125 1
            Type::method(),
126 1
            $channel,
127 1
            Methods::get('basic.recover'),
128 1
            new Bits($command->shouldRequeue())
129
        );
130
    }
131
132 1 View Code Duplication
    public function reject(FrameChannel $channel, Reject $command): Frame
0 ignored issues
show
Duplication introduced by
This method 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...
133
    {
134 1
        return new Frame(
135 1
            Type::method(),
136 1
            $channel,
137 1
            Methods::get('basic.reject'),
138 1
            new UnsignedLongLongInteger(new Integer($command->deliveryTag())),
139 1
            new Bits($command->shouldRequeue())
140
        );
141
    }
142
}
143