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 ( 414a11...09e31d )
by Baptiste
01:42
created

Basic::reject()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
dl 10
loc 10
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 7
nc 1
nop 2
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 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
        return new Frame(
38
            Type::method(),
39
            $channel,
40
            Methods::get('basic.ack'),
41
            new UnsignedLongLongInteger(new Integer($command->deliveryTag())),
42
            new Bits($command->isMultiple())
43
        );
44
    }
45
46
    public function cancel(FrameChannel $channel, Cancel $command): Frame
47
    {
48
        return new Frame(
49
            Type::method(),
50
            $channel,
51
            Methods::get('basic.cancel'),
52
            new ShortString(new Str($command->consumerTag())),
53
            new Bits(!$command->shouldWait())
54
        );
55
    }
56
57 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
        $consumerTag = '';
60
61
        if (!$command->shouldAutoGenerateConsumerTag()) {
62
            $consumerTag = $command->consumerTag();
63
        }
64
65
        return new Frame(
66
            Type::method(),
67
            $channel,
68
            Methods::get('basic.consume'),
69
            new UnsignedShortInteger(new Integer(0)), //ticket (reserved)
70
            new ShortString(new Str($command->queue())),
71
            new ShortString(new Str($consumerTag)),
72
            new Bits(!$command->isLocal()),
73
            new Bits($command->shouldAutoAcknowledge()),
74
            new Bits($command->isExclusive()),
75
            new Bits(!$command->shouldWait()),
76
            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...
77
        );
78
    }
79
80
    public function get(FrameChannel $channel, Get $command): Frame
81
    {
82
        return new Frame(
83
            Type::method(),
84
            $channel,
85
            Methods::get('basic.get'),
86
            new UnsignedShortInteger(new Integer(0)), //ticket (reserved)
87
            new ShortString(new Str($command->queue())),
88
            new Bits($command->shouldAutoAcknowledge())
89
        );
90
    }
91
92
    public function publish(FrameChannel $channel, Publish $command): Frame
93
    {
94
        return new Frame(
95
            Type::method(),
96
            $channel,
97
            Methods::get('basic.publish'),
98
            new UnsignedShortInteger(new Integer(0)), //ticket (reserved)
99
            new ShortString(new Str($command->exchange())),
100
            new ShortString(new Str($command->routingKey())),
101
            new Bits($command->mandatory()),
102
            new Bits($command->immediate())
103
        );
104
    }
105
106 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...
107
    {
108
        return new Frame(
109
            Type::method(),
110
            $channel,
111
            Methods::get('basic.qos'),
112
            new UnsignedLongInteger(new Integer($command->prefetchSize())),
113
            new UnsignedShortInteger(new Integer($command->prefetchCount())),
114
            new Bits($command->isGlobal())
115
        );
116
    }
117
118
    public function recover(FrameChannel $channel, Recover $command): Frame
119
    {
120
        return new Frame(
121
            Type::method(),
122
            $channel,
123
            Methods::get('basic.recover'),
124
            new Bits($command->shouldRequeue())
125
        );
126
    }
127
128 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...
129
    {
130
        return new Frame(
131
            Type::method(),
132
            $channel,
133
            Methods::get('basic.reject'),
134
            new UnsignedLongLongInteger(new Integer($command->deliveryTag())),
135
            new Bits($command->shouldRequeue())
136
        );
137
    }
138
}
139