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 ( 9ca54b...d40077 )
by Baptiste
01:45
created

Basic::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
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
    Transport\Protocol\ArgumentTranslator
27
};
28
use Innmind\Math\Algebra\Integer;
29
use Innmind\Immutable\{
30
    Str,
31
    Map
32
};
33
34
final class Basic implements BasicInterface
35
{
36
    private $translate;
37
38 88
    public function __construct(ArgumentTranslator $translator)
39
    {
40 88
        $this->translate = $translator;
41 88
    }
42
43 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...
44
    {
45 1
        return new Frame(
46 1
            Type::method(),
47 1
            $channel,
48 1
            Methods::get('basic.ack'),
49 1
            new UnsignedLongLongInteger(new Integer($command->deliveryTag())),
50 1
            new Bits($command->isMultiple())
51
        );
52
    }
53
54 1
    public function cancel(FrameChannel $channel, Cancel $command): Frame
55
    {
56 1
        return new Frame(
57 1
            Type::method(),
58 1
            $channel,
59 1
            Methods::get('basic.cancel'),
60 1
            new ShortString(new Str($command->consumerTag())),
61 1
            new Bits(!$command->shouldWait())
62
        );
63
    }
64
65 1
    public function consume(FrameChannel $channel, Consume $command): Frame
66
    {
67 1
        $consumerTag = '';
68
69 1
        if (!$command->shouldAutoGenerateConsumerTag()) {
70 1
            $consumerTag = $command->consumerTag();
71
        }
72
73 1
        return new Frame(
74 1
            Type::method(),
75 1
            $channel,
76 1
            Methods::get('basic.consume'),
77 1
            new UnsignedShortInteger(new Integer(0)), //ticket (reserved)
78 1
            new ShortString(new Str($command->queue())),
79 1
            new ShortString(new Str($consumerTag)),
80 1
            new Bits(
81 1
                !$command->isLocal(),
82 1
                $command->shouldAutoAcknowledge(),
83 1
                $command->isExclusive(),
84 1
                !$command->shouldWait()
85
            ),
86 1
            new Table(
87
                $command
88 1
                    ->arguments()
89 1
                    ->reduce(
90 1
                        new Map('string', Value::class),
91 1
                        function(Map $carry, string $key, $value): Map {
92 1
                            return $carry->put(
93 1
                                $key,
94 1
                                ($this->translate)($value)
95
                            );
96 1
                        }
97
                    )
98
            )
99
        );
100
    }
101
102 1
    public function get(FrameChannel $channel, Get $command): Frame
103
    {
104 1
        return new Frame(
105 1
            Type::method(),
106 1
            $channel,
107 1
            Methods::get('basic.get'),
108 1
            new UnsignedShortInteger(new Integer(0)), //ticket (reserved)
109 1
            new ShortString(new Str($command->queue())),
110 1
            new Bits($command->shouldAutoAcknowledge())
111
        );
112
    }
113
114 1
    public function publish(FrameChannel $channel, Publish $command): Frame
115
    {
116 1
        return new Frame(
117 1
            Type::method(),
118 1
            $channel,
119 1
            Methods::get('basic.publish'),
120 1
            new UnsignedShortInteger(new Integer(0)), //ticket (reserved)
121 1
            new ShortString(new Str($command->exchange())),
122 1
            new ShortString(new Str($command->routingKey())),
123 1
            new Bits(
124 1
                $command->mandatory(),
125 1
                $command->immediate()
126
            )
127
        );
128
    }
129
130 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...
131
    {
132 1
        return new Frame(
133 1
            Type::method(),
134 1
            $channel,
135 1
            Methods::get('basic.qos'),
136 1
            new UnsignedLongInteger(new Integer($command->prefetchSize())),
137 1
            new UnsignedShortInteger(new Integer($command->prefetchCount())),
138 1
            new Bits($command->isGlobal())
139
        );
140
    }
141
142 1
    public function recover(FrameChannel $channel, Recover $command): Frame
143
    {
144 1
        return new Frame(
145 1
            Type::method(),
146 1
            $channel,
147 1
            Methods::get('basic.recover'),
148 1
            new Bits($command->shouldRequeue())
149
        );
150
    }
151
152 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...
153
    {
154 1
        return new Frame(
155 1
            Type::method(),
156 1
            $channel,
157 1
            Methods::get('basic.reject'),
158 1
            new UnsignedLongLongInteger(new Integer($command->deliveryTag())),
159 1
            new Bits($command->shouldRequeue())
160
        );
161
    }
162
}
163