1 | <?php |
||
9 | final class ResponseSerializer implements SerializerInterface |
||
10 | { |
||
11 | /** |
||
12 | * @var array |
||
13 | */ |
||
14 | const REQUIRED_CACHE_KEYS = [ |
||
15 | 'statusCode', |
||
16 | 'headers', |
||
17 | 'body', |
||
18 | ]; |
||
19 | |||
20 | /** |
||
21 | * Unserializes cached data into the original psr response. |
||
22 | * |
||
23 | * @param mixed $data The data to unserialize. |
||
24 | * |
||
25 | * @return Psr7\Response |
||
26 | * |
||
27 | * @throws SerializerException Thrown if the given value cannot be unserialized. |
||
28 | */ |
||
29 | public function unserialize($data) |
||
41 | |||
42 | /** |
||
43 | * Serializes the given psr response for storage in caching. |
||
44 | * |
||
45 | * @param Psr7\Response $response The http response message to serialize for caching. |
||
46 | * |
||
47 | * @return mixed The result of serializing the given $data. |
||
48 | * |
||
49 | * @throws SerializerException Thrown if the given value cannot be serialized for caching. |
||
50 | */ |
||
51 | public function serialize($response) |
||
64 | |||
65 | private function validateCachedData($data) |
||
77 | } |
||
78 |