1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of the overtrue/wechat. |
||
5 | * |
||
6 | * (c) overtrue <[email protected]> |
||
7 | * |
||
8 | * This source file is subject to the MIT license that is bundled |
||
9 | * with this source code in the file LICENSE. |
||
10 | */ |
||
11 | |||
12 | namespace EasyWeChat\Kernel\Exceptions; |
||
13 | |||
14 | use Psr\Http\Message\ResponseInterface; |
||
15 | |||
16 | /** |
||
17 | * Class HttpException. |
||
18 | * |
||
19 | * @author overtrue <[email protected]> |
||
20 | */ |
||
21 | class HttpException extends Exception |
||
22 | { |
||
23 | /** |
||
24 | * @var \Psr\Http\Message\ResponseInterface|null |
||
25 | */ |
||
26 | public $response; |
||
27 | |||
28 | /** |
||
29 | * @var \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string|null |
||
30 | */ |
||
31 | public $formattedResponse; |
||
32 | |||
33 | /** |
||
34 | * HttpException constructor. |
||
35 | * |
||
36 | * @param string $message |
||
37 | * @param \Psr\Http\Message\ResponseInterface|null $response |
||
38 | * @param null $formattedResponse |
||
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||
39 | * @param int|null $code |
||
40 | */ |
||
41 | public function __construct($message, ResponseInterface $response = null, $formattedResponse = null, $code = null) |
||
42 | { |
||
43 | parent::__construct($message, $code); |
||
44 | |||
45 | $this->response = $response; |
||
46 | $this->formattedResponse = $formattedResponse; |
||
47 | |||
48 | if ($response) { |
||
49 | $response->getBody()->rewind(); |
||
50 | } |
||
51 | } |
||
52 | } |
||
53 |