DHL-PHP-SDK  v0.4
A wrapper for the DHL-XML-API Version 2
ExportDocPosition.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Petschko\DHL;
4 
16 use stdClass;
17 
34  private $description = null;
35 
44  private $countryCodeOrigin = null;
45 
54  private $customsTariffNumber = null;
55 
61  private $amount = null;
62 
68  private $netWeightInKG = null;
69 
75  private $customsValue = null;
76 
87  public function __construct($description, $countryCodeOrigin, $customsTariffNumber, $amount, $netWeightInKG, $customsValue) {
88  if(! $description || ! $countryCodeOrigin || ! $amount || ! $netWeightInKG || ! $customsValue) {
89  trigger_error('PHP-DHL-API: ' . __CLASS__ . '->' . __FUNCTION__ .
90  ': All values must be filled out! (Not null, Not false, Not 0, Not "", Not empty) - Ignore this function for this call now', E_USER_WARNING);
91  error_log('PHP-DHL-API: ' . __CLASS__ . '->' . __FUNCTION__ .
92  ': All values must be filled out! (Not null, Not false, Not 0, Not "", Not empty) - Ignore this function for this call now', E_USER_WARNING);
93  return;
94  }
95 
96  $this->setDescription($description);
97  $this->setCountryCodeOrigin($countryCodeOrigin);
98  $this->setCustomsTariffNumber($customsTariffNumber);
99  $this->setAmount($amount);
100  $this->setNetWeightInKG((float) $netWeightInKG);
101  $this->setCustomsValue((float) $customsValue);
102  }
103 
107  public function __destruct() {
108  unset($this->description);
109  unset($this->countryCodeOrigin);
110  unset($this->customsTariffNumber);
111  unset($this->amount);
112  unset($this->netWeightInKG);
113  unset($this->customsValue);
114  }
115 
121  public function getDescription() {
122  return $this->description;
123  }
124 
130  private function setDescription($description) {
131  $this->description = $description;
132  }
133 
139  public function getCountryCodeOrigin() {
140  return $this->countryCodeOrigin;
141  }
142 
148  private function setCountryCodeOrigin($countryCodeOrigin) {
149  $this->countryCodeOrigin = $countryCodeOrigin;
150  }
151 
157  public function getCustomsTariffNumber() {
158  return $this->customsTariffNumber;
159  }
160 
166  private function setCustomsTariffNumber($customsTariffNumber) {
167  $this->customsTariffNumber = $customsTariffNumber;
168  }
169 
175  public function getAmount() {
176  return $this->amount;
177  }
178 
184  private function setAmount($amount) {
185  $this->amount = $amount;
186  }
187 
193  public function getNetWeightInKG() {
194  return $this->netWeightInKG;
195  }
196 
202  private function setNetWeightInKG($netWeightInKG) {
203  $this->netWeightInKG = $netWeightInKG;
204  }
205 
211  public function getCustomsValue() {
212  return $this->customsValue;
213  }
214 
220  private function setCustomsValue($customsValue) {
221  $this->customsValue = $customsValue;
222  }
223 
231  protected function getExportDocPositionClass_v1() {
232  trigger_error('[DHL-PHP-SDK]: Version 1 Methods are deprecated and will removed soon (Called method ' . __METHOD__ . ')!', E_USER_DEPRECATED);
233  trigger_error('[DHL-PHP-SDK]: Called Version 1 Method: ' . __METHOD__ . ' is incomplete (does nothing)!', E_USER_WARNING);
234 
235  $class = new StdClass;
236 
237  return $class;
238  }
239 
245  public function getExportDocPositionClass_v2() {
246  $class = new StdClass;
247 
248  $class->description = $this->getDescription();
249  $class->countryCodeOrigin = $this->getCountryCodeOrigin();
250  $class->customsTariffNumber = $this->getCustomsTariffNumber();
251  $class->amount = $this->getAmount();
252  $class->netWeightInKG = $this->getNetWeightInKG();
253  $class->customsValue = $this->getCustomsValue();
254 
255  return $class;
256  }
257 }
__construct($description, $countryCodeOrigin, $customsTariffNumber, $amount, $netWeightInKG, $customsValue)