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 — master ( fc45f0...dd0edf )
by Baptiste
02:38
created

Get::__invoke()   A

Complexity

Conditions 1
Paths 2

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 2
nop 3
dl 0
loc 13
ccs 9
cts 9
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\AMQP\Command;
5
6
use Innmind\AMQP\{
7
    Client,
8
    Consumers,
9
    Model\Basic,
10
};
11
use Innmind\CLI\{
12
    Command,
13
    Command\Arguments,
14
    Command\Options,
15
    Environment,
16
};
17
18
final class Get implements Command
19
{
20
    private $client;
21
    private $consumers;
22
23 5
    public function __construct(Client $client, Consumers $consumers)
24
    {
25 5
        $this->client = $client;
26 5
        $this->consumers = $consumers;
27 5
    }
28
29 2
    public function __invoke(Environment $env, Arguments $arguments, Options $options): void
30
    {
31 2
        $queue = $arguments->get('queue');
32 2
        $consume = $this->consumers->get($queue);
33
34
        try {
35
            $this
36 2
                ->client
37 2
                ->channel()
38 2
                ->basic()
39 2
                ->get(new Basic\Get($queue))($consume);
40 1
        } finally {
41 2
            $this->client->close();
42
        }
43 1
    }
44
45 1
    public function __toString(): string
46
    {
47
        return <<<USAGE
48 1
innmind:amqp:get queue
49
50
Will process a single message from the given queue
51
USAGE;
52
    }
53
}
54