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

SlashCommandData::createForRequest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
c 0
b 0
f 0
rs 9.3142
cc 1
eloc 17
nc 1
nop 1
1
<?php
2
3
namespace Spatie\SlashCommand;
4
5
use Illuminate\Http\Request;
6
7
class SlashCommandData
8
{
9
    /** @var string */
10
    public $token;
11
12
    /** @var string */
13
    public $teamId;
14
15
    /** @var string */
16
    public $teamDomain;
17
18
    /** @var string */
19
    public $channelName;
20
21
    /** @var string */
22
    public $userId;
23
24
    /** @var string */
25
    public $userName;
26
27
    /** @var string */
28
    public $command;
29
30
    /** @var string */
31
    public $text;
32
33
    /** @var string */
34
    public $reponseUrl;
35
36
    public static function createForRequest(Request $request): SlashCommandData
37
    {
38
        return collect([
39
            'token',
40
            'team_id',
41
            'team_domain',
42
            'channel_id',
43
            'channel_name',
44
            'user_id',
45
            'user_name',
46
            'command',
47
            'text',
48
            'reponse_url'
49
        ])->reduce(function (SlashCommandData $slashCommandData, string $slackFieldName) use ($request) {
50
            $propertyName = camel_case($slackFieldName);
51
52
            $slashCommandData->$propertyName = $request->get($slackFieldName);
53
            
54
            return $slashCommandData;
55
        }, new static());
56
    }
57
}
58