Total Complexity | 4 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Coverage | 25% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class CouldNotSendNotification extends Exception |
||
9 | { |
||
10 | /** |
||
11 | * Thrown when content length is greater than 918 characters. |
||
12 | * |
||
13 | * @param $count |
||
14 | * @return static |
||
15 | */ |
||
16 | 1 | public static function contentLengthLimitExceeded($count): self |
|
17 | { |
||
18 | 1 | return new static("Notification was not sent. Content length may not be greater than {$count} characters.", 422); |
|
19 | } |
||
20 | |||
21 | /** |
||
22 | * Thrown when we're unable to communicate with smspoh. |
||
23 | * |
||
24 | * @param ClientException $exception |
||
25 | * |
||
26 | * @return static |
||
27 | */ |
||
28 | public static function smspohRespondedWithAnError(ClientException $exception): self |
||
29 | { |
||
30 | if (! $exception->hasResponse()) { |
||
31 | return new static('Smspoh responded with an error but no response body found'); |
||
32 | } |
||
33 | |||
34 | return new static("Smspoh responded with an error '{$exception->getCode()} : {$exception->getMessage()}'", $exception->getCode(), $exception); |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * Thrown when we're unable to communicate with smspoh. |
||
39 | * |
||
40 | * @param Exception $exception |
||
41 | * |
||
42 | * @return static |
||
43 | */ |
||
44 | public static function couldNotCommunicateWithSmspoh(Exception $exception): self |
||
47 | } |
||
48 | } |
||
49 |