DHL-PHP-SDK  v0.4
A wrapper for the DHL-XML-API Version 2
Address.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Petschko\DHL;
4 
21 abstract class Address {
30  private $streetName = '';
31 
40  private $streetNumber = '';
41 
51  private $addressAddition = null;
52 
62  private $dispatchingInfo = null;
63 
72  private $zip = '';
73 
82  private $location = '';
83 
93  private $country = null;
94 
104  private $countryISOCode = null;
105 
115  private $state = null;
116 
120  public function __construct() {
121  // VOID
122  }
123 
127  public function __destruct() {
128  unset($this->streetName);
129  unset($this->streetNumber);
130  unset($this->addressAddition);
131  unset($this->dispatchingInfo);
132  unset($this->zip);
133  unset($this->location);
134  unset($this->country);
135  unset($this->countryISOCode);
136  unset($this->state);
137  }
138 
144  public function getStreetName() {
145  return $this->streetName;
146  }
147 
153  public function setStreetName($streetName) {
154  $this->streetName = $streetName;
155  }
156 
162  public function getStreetNumber() {
163  return $this->streetNumber;
164  }
165 
171  public function setStreetNumber($streetNumber) {
172  $this->streetNumber = $streetNumber;
173  }
174 
180  public function getAddressAddition() {
181  return $this->addressAddition;
182  }
183 
189  public function setAddressAddition($addressAddition) {
190  $this->addressAddition = $addressAddition;
191  }
192 
198  public function getDispatchingInfo() {
199  return $this->dispatchingInfo;
200  }
201 
207  public function setDispatchingInfo($dispatchingInfo) {
208  $this->dispatchingInfo = $dispatchingInfo;
209  }
210 
216  public function getZip() {
217  return $this->zip;
218  }
219 
225  public function setZip($zip) {
226  $this->zip = $zip;
227  }
228 
234  public function getLocation() {
235  return $this->location;
236  }
237 
243  public function setLocation($location) {
244  $this->location = $location;
245  }
246 
252  public function getCity() {
253  return $this->location;
254  }
255 
261  public function setCity($city) {
262  $this->location = $city;
263  }
264 
270  public function getCountry() {
271  return $this->country;
272  }
273 
279  public final function setCountry($country) {
280  if($country !== null)
281  $this->country = mb_strtolower($country);
282  else
283  $this->country = null;
284  }
285 
291  public function getCountryISOCode() {
292  return $this->countryISOCode;
293  }
294 
300  public final function setCountryISOCode($countryISOCode) {
301  if($countryISOCode !== null)
302  $this->countryISOCode = mb_strtoupper($countryISOCode);
303  else
304  $this->countryISOCode = null;
305  }
306 
312  public function getState() {
313  return $this->state;
314  }
315 
321  public function setState($state) {
322  $this->state = $state;
323  }
324 
334  public final function setFullStreet($street) {
335  trigger_error('[DHL-PHP-SDK]: Called deprecated method ' . __METHOD__ . ': Buggy on some addresses, please separate the number and street by yourself. This method will removed in the future!', E_USER_DEPRECATED);
336 
337  $match = array();
338 
339  preg_match('/^([^\d]*[^\d\s]) *(\d.*)$/', $street, $match);
340 
341  if(count($match) == 0) return;
342 
343  $this->setStreetName($match[1]);
344  $this->setStreetNumber($match[2]);
345  }
346 }
setStreetName($streetName)
Definition: Address.php:153
setFullStreet($street)
Definition: Address.php:334
setStreetNumber($streetNumber)
Definition: Address.php:171
setAddressAddition($addressAddition)
Definition: Address.php:189
setCountry($country)
Definition: Address.php:279
setDispatchingInfo($dispatchingInfo)
Definition: Address.php:207
setCountryISOCode($countryISOCode)
Definition: Address.php:300
setLocation($location)
Definition: Address.php:243