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 ( a6da30...91246b )
by Freek
02:10
created

SignatureParts::getSlashCommandName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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