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 ( a71c17...924269 )
by Baptiste
02:08
created

Exchange   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 69.77 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 30
loc 43
c 0
b 0
f 0
wmc 5
lcom 1
cbo 5
ccs 20
cts 20
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A declare() 15 15 2
A delete() 15 15 2

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\Client\Channel\Exchange;
5
6
use Innmind\AMQP\{
7
    Client\Channel\Exchange as ExchangeInterface,
8
    Model\Exchange\Declaration,
9
    Model\Exchange\Deletion,
10
    Transport\Connection,
11
    Transport\Frame\Channel
12
};
13
14
final class Exchange implements ExchangeInterface
15
{
16
    private $connection;
17
    private $channel;
18
19 3
    public function __construct(Connection $connection, Channel $channel)
20
    {
21 3
        $this->connection = $connection;
22 3
        $this->channel = $channel;
23 3
    }
24
25 1 View Code Duplication
    public function declare(Declaration $command): ExchangeInterface
26
    {
27 1
        $this->connection->send(
28 1
            $this->connection->protocol()->exchange()->declare(
29 1
                $this->channel,
30 1
                $command
31
            )
32
        );
33
34 1
        if ($command->shouldWait()) {
35 1
            $this->connection->wait('exchange.declare-ok');
36
        }
37
38 1
        return $this;
39
    }
40
41 1 View Code Duplication
    public function delete(Deletion $command): ExchangeInterface
42
    {
43 1
        $this->connection->send(
44 1
            $this->connection->protocol()->exchange()->delete(
45 1
                $this->channel,
46 1
                $command
47
            )
48
        );
49
50 1
        if ($command->shouldWait()) {
51 1
            $this->connection->wait('exchange.delete-ok');
52
        }
53
54 1
        return $this;
55
    }
56
}
57