1 | <?php |
||
10 | final class JsonFormat extends AbstractFormat |
||
11 | { |
||
12 | 5 | public function serialize($var, Normalizers $normalizers) |
|
13 | { |
||
14 | 5 | $json = @json_encode($this->doSerialize($var, $normalizers)); |
|
15 | |||
16 | 3 | if(json_last_error() !== JSON_ERROR_NONE) { |
|
17 | 1 | throw new \RuntimeException(sprintf('JSON serialization failure: `%s`!', json_last_error_msg())); |
|
18 | } |
||
19 | |||
20 | 2 | return $json; |
|
21 | } |
||
22 | |||
23 | 2 | public function unserialize($var, $class, Hydrators $hydrators) |
|
27 | } |
||
28 |