1 | <?php declare(strict_types = 1); |
||
17 | class DateTimeSerializer |
||
18 | { |
||
19 | const DEFAULT_FORMAT = 'Y-m-d\TH:i:s.uP'; |
||
20 | |||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | private $format; |
||
25 | |||
26 | /** |
||
27 | * DateTimeSerializer constructor. |
||
28 | * |
||
29 | * @param string $format |
||
30 | */ |
||
31 | public function __construct(string $format = null) |
||
35 | |||
36 | /** |
||
37 | * @param \DateTimeInterface $value |
||
38 | * @param Schema $schema |
||
39 | * |
||
40 | * @return string |
||
41 | */ |
||
42 | public function serialize(\DateTimeInterface $value, Schema $schema): string |
||
50 | |||
51 | /** |
||
52 | * @param mixed $value |
||
53 | * @param Schema $schema |
||
54 | * |
||
55 | * @return \DateTime |
||
56 | * |
||
57 | */ |
||
58 | public function deserialize($value, Schema $schema): \DateTime |
||
75 | } |
||
76 |