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