Ejemplo n.º 1
0
 /**
  * Convert google object to model
  *
  * @param \Google_Service_Calendar_EventDateTime $timeItem
  * @param \KevinDitscheid\KdCalendar\Domain\Model\Time $time
  *
  * @return \KevinDitscheid\KdCalendar\Domain\Model\Time
  */
 public static function convert($timeItem, $time = NULL)
 {
     if ($time === NULL) {
         $time = new \KevinDitscheid\KdCalendar\Domain\Model\Time();
     }
     if ($timeItem->getDate() && !$timeItem->getDateTime()) {
         $time->setDate(\date_create($timeItem->getDate()));
         $time->setDateTime(\date_create($timeItem->getDate()));
     } elseif ($timeItem->getDate() && $timeItem->getDateTime()) {
         $time->setDate(\date_create($timeItem->getDate()));
         $time->setDateTime(\date_create($timeItem->getDateTime()));
     } elseif (!$timeItem->getDate() && $timeItem->getDateTime()) {
         $time->setDate(\date_create($timeItem->getDateTime()));
         $time->setDateTime(\date_create($timeItem->getDateTime()));
     }
     $time->setTimeZone($timeItem->getTimeZone());
     return $time;
 }