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 ( a0fab7...d931ca )
by Sebastian
02:48
created

RegexFailed::replace()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 3
1
<?php
2
3
namespace Spatie\Regex;
4
5
use Exception;
6
7
class RegexFailed extends Exception
8
{
9
    public static function match(string $pattern, string $subject, string $message): self
10
    {
11
        $subject = static::trimString($subject);
12
13
        return new static("Error matching pattern `{$pattern}` with subject `{$subject}`. {$message}");
14
    }
15
16
    public static function replace(string $pattern, string $subject, string $message): self
17
    {
18
        $subject = static::trimString($subject);
19
20
        return new static("Error replacing pattern `{$pattern}` in subject `{$subject}`. {$message}");
21
    }
22
23
    public static function groupDoesntExist(string $pattern, string $subject, int $index): self
24
    {
25
        return new static("Pattern `{$pattern}` with subject `{$subject}` didn't capture a group at index {$index}");
26
    }
27
28
    protected static function trimString(string $string): string
29
    {
30
        if (strlen($string) < 40) {
31
            return $string;
32
        }
33
34
        return substr($string, 0, 40).'...';
35
    }
36
}
37