예제 #1
0
 /**
  * Convert the raw XML into an object
  *
  * @param \SimpleXMLElement $xml
  * @return Timestamp
  */
 public static function createFromXML(\SimpleXMLElement $xml)
 {
     $timestamp = new Timestamp();
     if (isset($xml->date)) {
         if (isset($xml->timestart)) {
             $start = (string) $xml->date . ' ' . (string) $xml->timestart;
             $timestamp->setTimeStart(new \DateTime($start));
         }
         if (isset($xml->timeend)) {
             $end = (string) $xml->date . ' ' . (string) $xml->timeend;
             $timestamp->setTimeEnd(new \DateTime($end));
         }
     }
     return $timestamp;
 }