Exemplo n.º 1
0
 /**
  * @internal
  *
  * @param \SimpleXMLElement $xml
  *
  * @return Activity
  */
 public static function fromXml(\SimpleXMLElement $xml)
 {
     $activity = new Activity();
     $activity->setIsResponse();
     if (isset($xml->ActivityLocation->Code)) {
         $activity->setLocationCode($xml->ActivityLocation->Code);
     }
     if (isset($xml->ActivityLocation->Description)) {
         $activity->setLocationDescription($xml->ActivityLocation->Description);
     }
     if (isset($xml->ActivityLocation->SignedForByName)) {
         $activity->setSignedForBy($xml->ActivityLocation->SignedForByName);
     }
     if (isset($xml->Date) && isset($xml->Time)) {
         $activity->setTimestamp(new \DateTime($xml->Date . ' ' . $xml->Time));
     }
     if (isset($xml->Status->StatusType)) {
         $activity->setStatusType(StatusType::fromXml($xml->Status->StatusType));
     }
     if (isset($xml->Status->StatusCode)) {
         $activity->setStatusCode($xml->Status->StatusCode->Code);
     }
     if (isset($xml->ActivityLocation->Address)) {
         $activity->setAddress(Address::fromXml($xml->ActivityLocation->Address));
     }
     return $activity;
 }