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 ( faae32...638f88 )
by Baptiste
03:29
created

Channel   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 70
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 5.88%

Importance

Changes 0
Metric Value
wmc 11
lcom 0
cbo 2
dl 70
loc 70
ccs 2
cts 34
cp 0.0588
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
B __invoke() 30 30 6
A openOk() 4 4 1
A flow() 6 6 1
A flowOk() 6 6 1
A close() 9 9 1
A closeOk() 4 4 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\Reader;
5
6
use Innmind\AMQP\{
7
    Transport\Frame\Method,
8
    Transport\Frame\Visitor\Arguments,
9
    Transport\Frame\Value\Bits,
10
    Transport\Frame\Value\ShortString,
11
    Transport\Frame\Value\UnsignedShortInteger,
12
    Transport\Protocol\v091\Methods,
13
    Exception\UnknownMethod
14
};
15
use Innmind\Immutable\{
16
    Str,
17
    StreamInterface
18
};
19
20 View Code Duplication
final class Channel
0 ignored issues
show
Duplication introduced by
This class 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...
21
{
22
    /**
23
     * @return StreamInterface<Value>
0 ignored issues
show
Documentation introduced by
The doc-type StreamInterface<Value> could not be parsed: Expected "|" or "end of type", but got "<" at position 15. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
24
     */
25 1
    public function __invoke(Method $method, Str $arguments): StreamInterface
26
    {
27
        switch (true) {
28 1
            case Methods::get('channel.open-ok')->equals($method):
29
                $visit = $this->openOk();
30
                break;
31
32
            case Methods::get('channel.flow')->equals($method):
33
                $visit = $this->flow();
34
                break;
35
36
            case Methods::get('channel.flow-ok')->equals($method):
37
                $visit = $this->flowOk();
38
                break;
39
40
41
            case Methods::get('channel.close')->equals($method):
42
                $visit = $this->close();
43
                break;
44
45
            case Methods::get('channel.close-ok')->equals($method):
46
                $visit = $this->closeOk();
47
                break;
48
49
            default:
50
                throw new UnknownMethod($method);
51
        }
52
53
        return $visit($arguments);
54
    }
55
56
    private function openOk(): Arguments
57
    {
58
        return new Arguments; //no arguments
59
    }
60
61
    private function flow(): Arguments
62
    {
63
        return new Arguments(
64
            Bits::class //active
65
        );
66
    }
67
68
    private function flowOk(): Arguments
69
    {
70
        return new Arguments(
71
            Bits::class //active
72
        );
73
    }
74
75
    private function close(): Arguments
76
    {
77
        return new Arguments(
78
            UnsignedShortInteger::class, //reply code
79
            ShortString::class, //reply text
80
            UnsignedShortInteger::class, //failing class id
81
            UnsignedShortInteger::class //failing method id
82
        );
83
    }
84
85
    private function closeOk(): Arguments
86
    {
87
        return new Arguments; // no arguments
88
    }
89
}
90