| @@ 46-59 (lines=14) @@ | ||
| 43 | * @param ResponseInterface $response |
|
| 44 | * @return string |
|
| 45 | */ |
|
| 46 | protected function serializeResponse($response) |
|
| 47 | { |
|
| 48 | /** @var ResponseInterface $response */ |
|
| 49 | $serialized = serialize([ |
|
| 50 | $response->getStatusCode(), |
|
| 51 | $response->getHeaders(), |
|
| 52 | $response->getBody()->getContents(), |
|
| 53 | ]); |
|
| 54 | ||
| 55 | //subsequent calls need to access the stream from the beginning |
|
| 56 | $response->getBody()->seek(0); |
|
| 57 | ||
| 58 | return $serialized; |
|
| 59 | } |
|
| 60 | ||
| 61 | /** |
|
| 62 | * Unserializes the serialized response into a ResponseInterface instance |
|
| @@ 36-49 (lines=14) @@ | ||
| 33 | * @param ResponseInterface $response |
|
| 34 | * @return string |
|
| 35 | */ |
|
| 36 | protected function serializeResponse($response) |
|
| 37 | { |
|
| 38 | /** @var ResponseInterface $response */ |
|
| 39 | $serialized = serialize([ |
|
| 40 | $response->getStatusCode(), |
|
| 41 | $response->getHeaders(), |
|
| 42 | $response->getBody()->getContents(), |
|
| 43 | ]); |
|
| 44 | ||
| 45 | //subsequent calls need to access the stream from the beginning |
|
| 46 | $response->getBody()->rewind(); |
|
| 47 | ||
| 48 | return $serialized; |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * @inheritdoc |
|