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 ( 789986...f8b0bb )
by Freek
01:34
created

RequestSignature::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Spatie\SlashCommand;
4
5
use Illuminate\Http\Request as IlluminateRequest;
6
7
class RequestSignature
8
{
9
    const SLACK_REQUEST_VERSION = 'v0';
10
11
    public function create(IlluminateRequest $request): string
12
    {
13
        return self::SLACK_REQUEST_VERSION
14
            .'='
15
            .hash_hmac(
16
                'sha256',
17
                $this->createBaseString($request),
18
                config('laravel-slack-slash-command.signing_secret')
19
            );
20
    }
21
22
    private function createBaseString(IlluminateRequest $request): string
23
    {
24
        return implode(':', $this->getSignatureData($request));
25
    }
26
27
    private function getSignatureData(IlluminateRequest $request): array
28
    {
29
        return [
30
            self::SLACK_REQUEST_VERSION,
31
            $request->header('X-Slack-Request-Timestamp'),
32
            http_build_query($request->all()),
33
        ];
34
    }
35
}
36