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 ( 03c23b...59992b )
by Freek
02:08
created

ArtisanJob::handle()   A

Complexity

Conditions 2
Paths 3

Size

Total Lines 20
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 20
rs 9.4285
c 1
b 0
f 0
cc 2
eloc 11
nc 3
nop 0
1
<?php
2
3
namespace Spatie\SlashCommand\Jobs;
4
5
use Artisan;
6
use Spatie\SlashCommand\Attachment;
7
use Symfony\Component\Console\Exception\CommandNotFoundException;
8
9
class ArtisanJob extends SlashCommandResponseJob
10
{
11
    public function handle()
12
    {
13
        $artisanCommand = substr($this->request->text, 8);
14
15
        try {
16
            Artisan::call($artisanCommand, []);
17
18
            $this->respondToSlack(Artisan::output())->send();
19
        } catch (CommandNotFoundException $exception) {
20
            $this->respondToSlack("Whoops... something went wrong!")
21
                ->withAttachment(Attachment::create()
22
                    ->setColor('danger')
23
                    ->setText("The Artisan command `{$artisanCommand}` does not exist.")
24
                )
25
                ->send();
26
27
        }
28
29
30
    }
31
}