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.

CouldNotSendNotification   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 46
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A contentLengthLimitExceeded() 0 6 1
A smscRespondedWithAnError() 0 8 1
A couldNotCommunicateWithSmsc() 0 8 1
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