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

MnsCreateQueueCommand::handle()   A

Complexity

Conditions 3
Paths 12

Size

Total Lines 17
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 13
nc 12
nop 0
dl 0
loc 17
rs 9.4285
c 0
b 0
f 0
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
use AliyunMNS\Requests\CreateQueueRequest;
21
22
class MnsCreateQueueCommand extends Command
23
{
24
    /**
25
     * The name and signature of the console command.
26
     *
27
     * @var string
28
     */
29
    protected $signature = 'queue:mns:create {queue?} {--c|connection=mns}';
30
    /**
31
     * The console command description.
32
     *
33
     * @var string
34
     */
35
    protected $description = '创建 MNS Queue';
36
37
    /**
38
     * Execute the console command.
39
     *
40
     * @return void
41
     */
42
    public function handle()
43
    {
44
        $queue = $this->argument('queue');
45
        $connection = $this->option('connection');
46
        $config = config("queue.connections.{$connection}");
47
        if (!$queue) {
48
            $queue = $this->ask('请输入队列名称');
49
        }
50
51
        try {
52
            $client = new Client($config['endpoint'], $config['key'], $config['secret']);
53
            $request = new CreateQueueRequest($queue);
54
            $client->createQueue($request);
55
            $this->info('队列创建成功');
56
            $this->alert($queue);
57
        } catch (MnsException $e) {
58
            $this->error('队列创建失败:' . $e);
59
        }
60
    }
61
}
62