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
Branch master (645780)
by milkmeowo
05:42
created

MnsDeleteQueueCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 3
1
<?php
2
3
/*
4
 * Laravel-Mns -- 阿里云消息队列(MNS)的 Laravel 适配。
5
 *
6
 * This file is part of the milkmeowo/laravel-mns.
7
 *
8
 * (c) Milkmeowo <[email protected]>
9
 * @link: https://github.com/milkmeowo/laravel-queue-aliyun-mns
10
 *
11
 * This source file is subject to the MIT license that is bundled
12
 * with this source code in the file LICENSE.
13
 */
14
15
namespace Milkmeowo\LaravelMns\Console;
16
17
use AliyunMNS\Client;
18
use Illuminate\Console\Command;
19
use AliyunMNS\Exception\MnsException;
20
21
class MnsDeleteQueueCommand extends Command
22
{
23
    /**
24
     * The name and signature of the console command.
25
     *
26
     * @var string
27
     */
28
    protected $signature = 'queue:mns:delete {queue?} {--c|connection=mns}';
29
    /**
30
     * The console command description.
31
     *
32
     * @var string
33
     */
34
    protected $description = '删除 MNS Queue';
35
36
    /**
37
     * Execute the console command.
38
     *
39
     * @return void
40
     */
41
    public function handle()
42
    {
43
        $queue = $this->argument('queue');
44
        $connection = $this->option('connection');
45
        $config = config("queue.connections.{$connection}");
46
        if (!$queue) {
47
            $queue = $this->ask('请输入队列名称');
48
        }
49
50
        try {
51
            $client = new Client($config['endpoint'], $config['key'], $config['secret']);
52
            $client->deleteQueue($queue);
53
            $this->info('队列删除成功');
54
            $this->alert($queue);
55
        } catch (MnsException $e) {
56
            $this->error('队列删除失败:' . $e);
57
        }
58
    }
59
}
60