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

Purge::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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
    Model\Queue,
9
    Exception\UnexpectedFrame,
10
};
11
use Innmind\CLI\{
12
    Command,
13
    Command\Arguments,
14
    Command\Options,
15
    Environment,
16
};
17
use Innmind\Immutable\Str;
18
19
final class Purge implements Command
20
{
21
    private $client;
22
23 6
    public function __construct(Client $client)
24
    {
25 6
        $this->client = $client;
26 6
    }
27
28 3
    public function __invoke(Environment $env, Arguments $arguments, Options $options): void
29
    {
30 3
        $queue = $arguments->get('queue');
31
32
        try {
33
            $this
34 3
                ->client
35 3
                ->channel()
36 2
                ->queue()
37 2
                ->purge(new Queue\Purge($queue));
38 2
        } catch (UnexpectedFrame $e) {
39 1
            $env->error()->write(Str::of("Purging \"$queue\" failed"));
40 1
            $env->exit(1);
41 2
        } finally {
42 3
            $this->client->close();
43
        }
44 2
    }
45
46 1
    public function __toString(): string
47
    {
48
        return <<<USAGE
49 1
innmind:amqp:purge queue
50
51
Will delete all messages for the given queue
52
USAGE;
53
    }
54
}
55