1 | <?php |
||
7 | class CouldNotSendNotification extends \Exception |
||
8 | { |
||
9 | private $response; |
||
10 | |||
11 | /** |
||
12 | * @param Response $response |
||
13 | * @param string $message |
||
14 | * @param int|null $code |
||
15 | */ |
||
16 | 1 | public function __construct(Response $response, string $message, int $code = null) |
|
24 | |||
25 | /** |
||
26 | * @param Response $response |
||
27 | * @return self |
||
28 | */ |
||
29 | 1 | public static function serviceRespondedWithAnError(Response $response) |
|
30 | { |
||
31 | 1 | return new self( |
|
32 | 1 | $response, |
|
33 | 1 | sprintf('Webhook responded with an error: `%s`', $response->getBody()->getContents()) |
|
34 | ); |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * @return Response |
||
39 | */ |
||
40 | public function getResponse() |
||
44 | } |
||
45 |