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 ( c4effd...5428db )
by Freek
03:22
created

BaseHandler::getSlashCommandData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Spatie\SlashCommand\SlashCommandHandler;
4
5
use Illuminate\Foundation\Bus\DispatchesJobs;
6
use Illuminate\Http\Request;
7
use Spatie\SlashCommand\HandlesSlashCommand;
8
use Spatie\SlashCommand\SlashCommandData;
9
use Spatie\SlashCommand\SlashCommandResponse;
10
use Spatie\SlashCommand\SlashCommandResponseJob;
11
12
abstract class BaseHandler implements HandlesSlashCommand
13
{
14
    use DispatchesJobs;
15
16
    /** @var \Spatie\SlashCommand\SlashCommandRequest */
17
    protected $request;
18
19
    /** @var \Spatie\SlashCommand\SlashCommandData */
20
    protected $slashCommandData;
21
22
    public function __construct(Request $request)
0 ignored issues
show
Bug introduced by
You have injected the Request via parameter $request. This is generally not recommended as there might be multiple instances during a request cycle (f.e. when using sub-requests). Instead, it is recommended to inject the RequestStack and retrieve the current request each time you need it via getCurrentRequest().
Loading history...
23
    {
24
        $this->request = $request;
0 ignored issues
show
Documentation Bug introduced by
It seems like $request of type object<Illuminate\Http\Request> is incompatible with the declared type object<Spatie\SlashCommand\SlashCommandRequest> of property $request.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
25
26
        $this->slashCommandData = SlashCommandData::createForRequest($request);
27
    }
28
29
    public function respondToSlack(string $text): SlashCommandResponse
30
    {
31
        return SlashCommandResponse::create($this->slashCommandData)->setText($text);
32
    }
33
34
    protected function dispatch(SlashCommandResponseJob $job)
35
    {
36
        $job->slashCommandData = $this->slashCommandData;
37
38
        return app(Dispatcher::class)->dispatch($job);
39
    }
40
41
    public function getSlashCommandData(): SlashCommandData
42
    {
43
        return $this->getSlashCommandData();
44
    }
45
46
    abstract public function handleCurrentRequest(): SlashCommandResponse;
47
48
    abstract public function canHandleCurrentRequest(): bool;
49
}
50