Total Complexity | 3 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | final class JsonSerializer implements SerializerInterface |
||
8 | { |
||
9 | private $options; |
||
10 | |||
11 | /** |
||
12 | * JsonSerializer constructor. |
||
13 | * |
||
14 | * @param int $options integer the encoding options. For more details please refer to |
||
15 | * <http://www.php.net/manual/en/function.json-encode.php>. |
||
16 | * Default is `JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE`. |
||
17 | */ |
||
18 | public function __construct(int $options = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) |
||
19 | { |
||
20 | $this->options = $options; |
||
21 | } |
||
22 | |||
23 | public function serialize($value): string |
||
24 | { |
||
25 | return json_encode($value, $this->options); |
||
26 | } |
||
27 | |||
28 | public function unserialize(string $value) |
||
31 | } |
||
32 | } |
||
33 |