コード例 #1
0
 /**
  * @param  \SimpleXMLElement $xml
  * @return AtHome
  * @throws BpostNotImplementedException
  * @throws BpostXmlInvalidItemException
  * @throws \Bpost\BpostApiClient\BpostException
  */
 public static function createFromXML(\SimpleXMLElement $xml)
 {
     $self = new self();
     if (!isset($xml->atHome)) {
         throw new BpostXmlInvalidItemException();
     }
     $atHomeXml = $xml->atHome[0];
     $self = parent::createFromXML($atHomeXml, $self);
     if (isset($atHomeXml->receiver)) {
         $self->setReceiver(Receiver::createFromXML($atHomeXml->receiver->children('http://schema.post.be/shm/deepintegration/v3/common')));
     }
     if (isset($atHomeXml->requestedDeliveryDate) && $atHomeXml->requestedDeliveryDate != '') {
         $self->setRequestedDeliveryDate($atHomeXml->requestedDeliveryDate);
     }
     return $self;
 }