1 | <?php |
||
10 | final class JsonSerializer implements SerializerInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var boolean |
||
14 | */ |
||
15 | private $decodeAsAssoc = true; |
||
16 | |||
17 | /** |
||
18 | * @var integer |
||
19 | */ |
||
20 | private $encodeOptions = 0; |
||
21 | |||
22 | /** |
||
23 | * Construct a new JsonSerializer. |
||
24 | * |
||
25 | * @param boolean $decodeAsAssoc When TRUE, returned objects will be converted into associative arrays. |
||
26 | * @param integer $encodeOptions Bitmask consisting of json endoding options. |
||
27 | */ |
||
28 | public function __construct(bool $decodeAsAssoc = true, int $encodeOptions = 0) |
||
33 | |||
34 | /** |
||
35 | * Unserializes cached data into the original state. |
||
36 | * |
||
37 | * @param mixed $data The data to unserialize. |
||
38 | * |
||
39 | * @return mixed |
||
40 | * |
||
41 | * @throws InvalidArgumentException Thrown if the given value cannot be unserialized. |
||
42 | */ |
||
43 | public function unserialize($data) |
||
51 | |||
52 | /** |
||
53 | * Serializes the given data for storage in caching. |
||
54 | * |
||
55 | * @param mixed $value The data to serialize for caching. |
||
56 | * |
||
57 | * @return mixed The result of serializing the given $data. |
||
58 | * |
||
59 | * @throws InvalidArgumentException Thrown if the given value cannot be serialized for caching. |
||
60 | */ |
||
61 | public function serialize($value) |
||
69 | |||
70 | private function ensureJson() |
||
76 | } |
||
77 |