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

Exchange   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 36.36 %

Coupling/Cohesion

Components 0
Dependencies 12

Importance

Changes 0
Metric Value
dl 12
loc 33
c 0
b 0
f 0
wmc 2
lcom 0
cbo 12
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A declare() 0 17 1
A delete() 12 12 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\AMQP\Transport\Protocol\v091;
5
6
use Innmind\AMQP\{
7
    Model\Exchange\Declaration,
8
    Model\Exchange\Deletion,
9
    Transport\Frame,
10
    Transport\Frame\Channel as FrameChannel,
11
    Transport\Frame\Type,
12
    Transport\Frame\Value,
13
    Transport\Frame\Value\UnsignedShortInteger,
14
    Transport\Frame\Value\ShortString,
15
    Transport\Frame\Value\Bits,
16
    Transport\Frame\Value\Table,
17
    Transport\Protocol\Exchange as ExchangeInterface
18
};
19
use Innmind\Math\Algebra\Integer;
20
use Innmind\Immutable\{
21
    Str,
22
    Map
23
};
24
25
final class Exchange implements ExchangeInterface
26
{
27
    public function declare(FrameChannel $channel, Declaration $command): Frame
0 ignored issues
show
Coding Style introduced by
Possible parse error: non-abstract method defined as abstract
Loading history...
28
    {
29
        return new Frame(
30
            Type::method(),
31
            $channel,
32
            Methods::get('exchange.declare'),
33
            new UnsignedShortInteger(new Integer(0)), //ticket (reserved)
34
            new ShortString(new Str($command->name())),
35
            new ShortString(new Str((string) $command->type())),
36
            new Bits($command->isPassive()),
37
            new Bits($command->isDurable()),
38
            new Bits($command->isAutoDeleted()), //reserved
39
            new Bits(false), //internal (reserved)
40
            new Bits(!$command->shouldWait()),
41
            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...
42
        );
43
    }
44
45 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...
46
    {
47
        return new Frame(
48
            Type::method(),
49
            $channel,
50
            Methods::get('exchange.delete'),
51
            new UnsignedShortInteger(new Integer(0)), //ticket (reserved)
52
            new ShortString(new Str($command->name())),
53
            new Bits($command->onlyIfUnused()),
54
            new Bits(!$command->shouldWait())
55
        );
56
    }
57
}
58