1 | <?php |
||
7 | class DatetimeWithTimezoneTransformer implements DataTransformerInterface |
||
8 | { |
||
9 | /** |
||
10 | * Take a TimeDate object (with a timezone) and put its value on the time |
||
11 | * and timezone fields, so the user can see it |
||
12 | * |
||
13 | * @param \TimeDate $time |
||
14 | * @return array |
||
15 | */ |
||
16 | 1 | public function transform($time) |
|
27 | |||
28 | /** |
||
29 | * Take the timestamp from the time field and the timezone that the user |
||
30 | * provided and combine them into a single timezoned TimeDate |
||
31 | * |
||
32 | * @param array $data |
||
33 | * @return \TimeDate |
||
34 | */ |
||
35 | 1 | public function reverseTransform($data) |
|
39 | |||
40 | /** |
||
41 | * Create a TimeDate object from another one, ignoring its timezone |
||
42 | * |
||
43 | * @param \TimeDate $from The original timestamp |
||
44 | * @param string|null $timezone The timezone to add to the object (defaults |
||
45 | * to the PHP's default) |
||
46 | * @return \TimeDate |
||
47 | */ |
||
48 | 1 | private function createTimeDate($from, $timezone = null) |
|
67 | } |
||
68 |