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

Queue::delete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 13
Ratio 100 %

Importance

Changes 0
Metric Value
dl 13
loc 13
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 10
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\Queue\Declaration,
8
    Model\Queue\Deletion,
9
    Model\Queue\Binding,
10
    Model\Queue\Unbinding,
11
    Model\Queue\Purge,
12
    Transport\Frame,
13
    Transport\Frame\Channel as FrameChannel,
14
    Transport\Frame\Type,
15
    Transport\Frame\Value,
16
    Transport\Frame\Value\UnsignedShortInteger,
17
    Transport\Frame\Value\ShortString,
18
    Transport\Frame\Value\Bits,
19
    Transport\Frame\Value\Table,
20
    Transport\Protocol\Queue as QueueInterface
21
};
22
use Innmind\Math\Algebra\Integer;
23
use Innmind\Immutable\{
24
    Str,
25
    Map
26
};
27
28
final class Queue implements QueueInterface
29
{
30 View Code Duplication
    public function declare(FrameChannel $channel, Declaration $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...
Coding Style introduced by
Possible parse error: non-abstract method defined as abstract
Loading history...
31
    {
32
        $name = '';
33
34
        if (!$command->shouldAutoGenerateName()) {
35
            $name = $command->name();
36
        }
37
38
        return new Frame(
39
            Type::method(),
40
            $channel,
41
            Methods::get('queue.declare'),
42
            new UnsignedShortInteger(new Integer(0)), //ticket (reserved)
43
            new ShortString(new Str($name)),
44
            new Bits($command->isPassive()),
45
            new Bits($command->isDurable()),
46
            new Bits($command->isExclusive()),
47
            new Bits($command->isAutoDeleted()),
48
            new Bits(!$command->shouldWait()),
49
            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...
50
        );
51
    }
52
53 View Code Duplication
    public function delete(FrameChannel $channel, Deletion $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...
54
    {
55
        return new Frame(
56
            Type::method(),
57
            $channel,
58
            Methods::get('queue.delete'),
59
            new UnsignedShortInteger(new Integer(0)), //ticket (reserved)
60
            new ShortString(new Str($command->name())),
61
            new Bits($command->onlyIfUnused()),
62
            new Bits($command->onlyIfEmpty()),
63
            new Bits(!$command->shouldWait())
64
        );
65
    }
66
67 View Code Duplication
    public function bind(FrameChannel $channel, Binding $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...
68
    {
69
        return new Frame(
70
            Type::method(),
71
            $channel,
72
            Methods::get('queue.bind'),
73
            new UnsignedShortInteger(new Integer(0)), //ticket (reserved)
74
            new ShortString(new Str($command->queue())),
75
            new ShortString(new Str($command->exchange())),
76
            new ShortString(new Str($command->routingKey())),
77
            new Bits(!$command->shouldWait()),
78
            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 View Code Duplication
    public function unbind(FrameChannel $channel, Unbinding $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...
83
    {
84
        return new Frame(
85
            Type::method(),
86
            $channel,
87
            Methods::get('queue.unbind'),
88
            new UnsignedShortInteger(new Integer(0)), //ticket (reserved)
89
            new ShortString(new Str($command->queue())),
90
            new ShortString(new Str($command->exchange())),
91
            new ShortString(new Str($command->routingKey())),
92
            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...
93
        );
94
    }
95
96 View Code Duplication
    public function purge(FrameChannel $channel, Purge $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...
97
    {
98
        return new Frame(
99
            Type::method(),
100
            $channel,
101
            Methods::get('queue.purge'),
102
            new UnsignedShortInteger(new Integer(0)), //ticket (reserved)
103
            new ShortString(new Str($command->name())),
104
            new Bits(!$command->shouldWait())
105
        );
106
    }
107
}
108