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   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
handleCurrentRequest() 0 1 ?
canHandleCurrentRequest() 0 1 ?
A getCommandText() 0 4 1
A respond() 0 4 1
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