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.

SignatureParts::getHandlerName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Spatie\SlashCommand\Handlers;
4
5
use Illuminate\Support\Str;
6
use Spatie\SlashCommand\Exceptions\InvalidSignature;
7
8
class SignatureParts
9
{
10
    /** @var string */
11
    protected $signature;
12
13
    public function __construct(string $signature)
14
    {
15
        $this->signature = $signature;
16
17
        if (! Str::contains($this->signature, ' ')) {
18
            throw InvalidSignature::signatureMustContainASpace($this->signature);
19
        }
20
    }
21
22
    public function getSlashCommandName(): string
23
    {
24
        return ltrim(explode(' ', $this->signature)[0], '/');
25
    }
26
27
    public function getHandlerName(): string
28
    {
29
        return explode(' ', $this->signature)[1];
30
    }
31
32
    public function getSignatureWithoutCommandName(): string
33
    {
34
        return explode(' ', $this->signature, 2)[1];
35
    }
36
37
    public function getArgumentsAndOptions(): string
38
    {
39
        return explode(' ', $this->signature, 3)[2];
40
    }
41
}
42