Conditions | 5 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
34 | public function deserializeDateTimeFromJson(JsonDeserializationVisitor $visitor, $data, array $type) |
||
35 | { |
||
36 | // Handle empty or invalid date / datetime values. |
||
37 | if ('' === $data || null === $data || strpos($data, '0000-00-00') !== false) { |
||
38 | return null; |
||
39 | } |
||
40 | |||
41 | // We want to always show the response in the UTC timezone. |
||
42 | $dateTime = parent::deserializeDateTimeFromJson($visitor, $data, $type); |
||
43 | |||
44 | if ($dateTime instanceof \DateTime) { |
||
45 | $dateTime->setTimezone(new \DateTimeZone('UTC')); |
||
46 | } |
||
47 | |||
48 | return $dateTime; |
||
49 | } |
||
50 | } |
||
51 |