DHL-PHP-SDK  v0.4
A wrapper for the DHL-XML-API Version 2
Receiver.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Petschko\DHL;
4 
16 use stdClass;
17 
23 class Receiver extends SendPerson {
29  public function getClass_v2() {
30  $class = new StdClass;
31 
32  $class->name1 = $this->getName();
33 
34  // Communication
35  $class->Communication = new StdClass;
36  if($this->getPhone() !== null)
37  $class->Communication->phone = $this->getPhone();
38  if($this->getEmail() !== null)
39  $class->Communication->email = $this->getEmail();
40  if($this->getContactPerson() !== null)
41  $class->Communication->contactPerson = $this->getContactPerson();
42 
43  // Address
44  $class->Address = new StdClass;
45  if($this->getName2() !== null)
46  $class->Address->name2 = $this->getName2();
47  if($this->getName3() !== null)
48  $class->Address->name3 = $this->getName3();
49  $class->Address->streetName = $this->getStreetName();
50  $class->Address->streetNumber = $this->getStreetNumber();
51  if($this->getAddressAddition() !== null)
52  $class->Address->addressAddition = $this->getAddressAddition();
53  if($this->getDispatchingInfo() !== null)
54  $class->Address->dispatchingInformation = $this->getDispatchingInfo();
55  $class->Address->zip = $this->getZip();
56  $class->Address->city = $this->getLocation();
57 
58  // Origin
59  if($this->getCountryISOCode() !== null) {
60  $class->Address->Origin = new StdClass;
61  if($this->getCountry() !== null)
62  $class->Address->Origin->country = $this->getCountry();
63  $class->Address->Origin->countryISOCode = $this->getCountryISOCode();
64  if($this->getState() !== null)
65  $class->Address->Origin->state = $this->getState();
66  }
67 
68  return $class;
69  }
70 }