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 ( 9ca3c4...0e5848 )
by Freek
02:03
created

BaseHandler   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 33
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A respondToSlack() 0 4 1
A dispatch() 0 6 1
A getRequest() 0 4 1
handle() 0 1 ?
canHandle() 0 1 ?
1
<?php
2
3
namespace Spatie\SlashCommand\Handlers;
4
5
use Illuminate\Contracts\Bus\Dispatcher;
6
use Illuminate\Foundation\Bus\DispatchesJobs;
7
use Spatie\SlashCommand\HandlesSlashCommand;
8
use Spatie\SlashCommand\Jobs\ResponseJob;
9
use Spatie\SlashCommand\Request;
10
use Spatie\SlashCommand\Response;
11
12
abstract class BaseHandler implements HandlesSlashCommand
13
{
14
    use DispatchesJobs;
15
16
    /** @var \Spatie\SlashCommand\Request */
17
    protected $request;
18
19
    public function __construct(Request $request)
20
    {
21
        $this->request = $request;
22
    }
23
24
    public function respondToSlack(string $text): Response
25
    {
26
        return Response::create($this->request)->setText($text);
27
    }
28
29
    protected function dispatch(ResponseJob $job)
30
    {
31
        $job->setResponse($this->request);
32
33
        return app(Dispatcher::class)->dispatch($job);
34
    }
35
36
    public function getRequest(): Request
37
    {
38
        return $this->getRequest();
39
    }
40
41
    abstract public function handle(Request $request): Response;
42
43
    abstract public function canHandle(Request $request): bool;
44
}
45