← All changes
|
vendor/wpfluent/framework/src/WPFluent/Http/Response.php
+13
-2
1.0.92
→
2.11.0
View file →
| @@ -7,9 +7,9 @@ | ||
| 7 | 7 | * |
| 8 | 8 | * Handles HTTP responses for HTTP Client class, |
| 9 | 9 | * providing methods to access response data. |
| 10 | 10 | */ |
| 11 | -class Response | |
| 11 | +class Response implements \JsonSerializable | |
| 12 | 12 | { |
| 13 | 13 | /** |
| 14 | 14 | * The HTTP response data. |
| 15 | 15 | * |
| @@ -37,8 +37,19 @@ | ||
| 37 | 37 | return $this->response; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | + * Convert the response object to an array. | |
| 42 | + * | |
| 43 | + * @return array | |
| 44 | + */ | |
| 45 | + #[\ReturnTypeWillChange] | |
| 46 | + public function jsonSerialize() | |
| 47 | + { | |
| 48 | + return $this->toArray(); | |
| 49 | + } | |
| 50 | + | |
| 51 | + /** | |
| 41 | 52 | * Get the HTTP response object. |
| 42 | 53 | * |
| 43 | 54 | * @return mixed |
| 44 | 55 | */ |
| @@ -77,9 +88,9 @@ | ||
| 77 | 88 | |
| 78 | 89 | /** |
| 79 | 90 | * Throw an exception based on the response status code. |
| 80 | 91 | * |
| 81 | - * @throws \WpOrg\Requests\Exception\Http\Status | |
| 92 | + * @throws \WpOrg\Requests\Exception | |
| 82 | 93 | */ |
| 83 | 94 | public function throw() |
| 84 | 95 | { |
| 85 | 96 | $class = sprintf( |