예제 #1
0
파일: Shipment.php 프로젝트: camigreen/ttop
 /**
  * @internal
  *
  * @param \SimpleXMLElement $xml
  *
  * @return Shipment
  */
 public static function fromXml(\SimpleXMLElement $xml)
 {
     $shipment = new Shipment();
     $shipment->setIsResponse();
     if (isset($xml->Shipper)) {
         $shipment->setShipper(Shipper::fromXml($xml->Shipper));
     }
     if (isset($xml->ShipTo->Address)) {
         $shipment->setDestination(InstructionalAddress::fromXml($xml->ShipTo->Address));
     }
     if (isset($xml->Package)) {
         foreach ($xml->Package as $package) {
             $shipment->addPackage(Package::fromXml($package));
         }
     }
     if (isset($xml->Service)) {
         $shipment->setService(Service::fromXml($xml->Service));
     }
     return $shipment;
 }
예제 #2
0
파일: Package.php 프로젝트: camigreen/ttop
 /**
  * @internal
  *
  * @param Weight $weight
  *
  * @return Package
  */
 public function setWeight(Weight $weight)
 {
     parent::setWeight($weight);
     return $this;
 }