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 ( 94f263...4f7e56 )
by Freek
02:01
created

BaseHandler::getCommandText()   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
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Spatie\SlashCommand\SlashCommandHandler;
4
5
use Illuminate\Http\Request;
6
use Spatie\SlashCommand\SlashCommandResponse;
7
8
abstract class BaseHandler
9
{
10
    /** @var \Spatie\SlashCommand\SlashCommandRequest */
11
    protected $request;
12
13
    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...
14
        $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...
15
    }
16
    
17
    abstract public function handleCurrentRequest(): SlashCommandResponse;
18
19
    abstract public function canHandleCurrentRequest(): bool;
20
21
    public function getCommandText()
22
    {
23
        return $this->request->get('text');
24
    }
25
26
    public function respond(string $text): SlashCommandResponse
27
    {
28
        return SlashCommandResponse::createForRequest($this->request)->setText($text);
29
    }
30
}
31