Total Complexity | 4 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
8 | class CouldNotSendNotification extends Exception |
||
9 | { |
||
10 | /** |
||
11 | * Thrown when an invalid message was passed. |
||
12 | * |
||
13 | * @param mixed $message |
||
14 | * @return static |
||
15 | */ |
||
16 | 4 | public static function invalidMessage($message) |
|
17 | { |
||
18 | 4 | $type = is_object($message) ? get_class($message) : gettype($message); |
|
19 | |||
20 | 4 | return new static('The message should be an instance of '.Message::class.". Given `{$type}` is invalid.", 1); |
|
21 | } |
||
22 | |||
23 | /** |
||
24 | * Thrown when sending failed. |
||
25 | * |
||
26 | * @param string $webhook |
||
27 | * @param mixed $payload |
||
28 | * @return static |
||
29 | */ |
||
30 | 4 | public static function sendingFailed($webhook, $payload) |
|
37 | } |
||
38 | } |
||
39 |