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.

smscRespondedWithAnError()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace NotificationChannels\SmscRu\Exceptions;
4
5
use DomainException;
6
use Exception;
7
8
class CouldNotSendNotification extends Exception
9
{
10
    /**
11
     * Thrown when content length is greater than 800 characters.
12
     *
13
     * @return static
14
     */
15
    public static function contentLengthLimitExceeded(): self
16
    {
17
        return new static(
18
            'Notification was not sent. Content length may not be greater than 800 characters.'
19
        );
20
    }
21
22
    /**
23
     * Thrown when we're unable to communicate with smsc.ru.
24
     *
25
     * @param  DomainException  $exception
26
     *
27
     * @return static
28
     */
29
    public static function smscRespondedWithAnError(DomainException $exception): self
30
    {
31
        return new static(
32
            "smsc.ru responded with an error '{$exception->getCode()}: {$exception->getMessage()}'",
33
            $exception->getCode(),
34
            $exception
35
        );
36
    }
37
38
    /**
39
     * Thrown when we're unable to communicate with smsc.ru.
40
     *
41
     * @param  Exception  $exception
42
     *
43
     * @return static
44
     */
45
    public static function couldNotCommunicateWithSmsc(Exception $exception): self
46
    {
47
        return new static(
48
            "The communication with smsc.ru failed. Reason: {$exception->getMessage()}",
49
            $exception->getCode(),
50
            $exception
51
        );
52
    }
53
}
54