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.

Exchange   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 33
dl 0
loc 50
ccs 33
cts 33
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A delete() 0 10 1
A declare() 0 24 1
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
    Transport\Protocol\ArgumentTranslator,
19
};
20
use Innmind\Math\Algebra\Integer;
21
use Innmind\Immutable\{
22
    Str,
23
    Map,
24
};
25
26
final class Exchange implements ExchangeInterface
27
{
28
    private $translate;
29
30 244
    public function __construct(ArgumentTranslator $translator)
31
    {
32 244
        $this->translate = $translator;
33 244
    }
34
35 4
    public function declare(FrameChannel $channel, Declaration $command): Frame
36
    {
37 4
        return Frame::method(
38 4
            $channel,
39 4
            Methods::get('exchange.declare'),
40 4
            new UnsignedShortInteger(new Integer(0)), //ticket (reserved)
41 4
            ShortString::of(new Str($command->name())),
42 4
            ShortString::of(new Str((string) $command->type())),
43 4
            new Bits(
44 4
                $command->isPassive(),
45 4
                $command->isDurable(),
46 4
                $command->isAutoDeleted(), //reserved
47 4
                false, //internal (reserved)
48 4
                !$command->shouldWait()
49
            ),
50 4
            new Table(
51
                $command
52 4
                    ->arguments()
53 4
                    ->reduce(
54 4
                        new Map('string', Value::class),
55
                        function(Map $carry, string $key, $value): Map {
56 2
                            return $carry->put(
57 2
                                $key,
58 2
                                ($this->translate)($value)
59
                            );
60 4
                        }
61
                    )
62
            )
63
        );
64
    }
65
66 4
    public function delete(FrameChannel $channel, Deletion $command): Frame
67
    {
68 4
        return Frame::method(
69 4
            $channel,
70 4
            Methods::get('exchange.delete'),
71 4
            new UnsignedShortInteger(new Integer(0)), //ticket (reserved)
72 4
            ShortString::of(new Str($command->name())),
73 4
            new Bits(
74 4
                $command->onlyIfUnused(),
75 4
                !$command->shouldWait()
76
            )
77
        );
78
    }
79
}
80