DHL-PHP-SDK  v0.4
A wrapper for the DHL-XML-API Version 2
ProductInfo.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Petschko\DHL;
4 
20 class ProductInfo {
26  private static $init = false;
27 
33  public static $serviceNames = array(
34  'preferredNeighbourEnabled' => 'Wunschnachbar',
35  'preferredLocationEnabled' => 'Wunschort',
36  'visualCheckOfAgeEnabled' => 'Alterssichtprüfung',
37  'personalHandover' => 'Eigenhändig',
38  'namedPersonOnly' => 'persönliche Übergabe',
39  'identCheckEnabled' => 'Ident-Check',
40  'endorsementEnabled' => 'Vorausverfügung',
41  'returnReceipt' => 'Rückschein',
42  'preferredDayEnabled' => 'Wunschtag',
43  'preferredTimeEnabled' => 'Wunschzeit',
44  'disableNeighbourDelivery' => 'keine Nachbarschaftszustellung',
45  'goGreen' => 'GoGreen',
46  'additionalInsuranceEnabled' => 'Transportversicherung',
47  'bulkyGoods' => 'Sperrgut',
48  'cashOnDeliveryEnabled' => 'Nachnahme',
49  'dayOfDeliveryEnabled' => 'Zustelldatum',
50  'deliveryTimeframeEnabled' => 'Zustellzeitfenster',
51  'shipmentHandlingEnabled' => 'Sendungshandling',
52  'perishables' => 'verderbliche Ware',
53  'individualSenderRequiredmentsEnabled' => 'Individuelle Senderhinweise',
54  'premium' => 'Premium',
55  'packagingReturn' => 'Verpackungsrücknahme',
56  'noticeNonDeliverability' => 'Unzustellbarkeitsnachricht',
57  'returnImmediatlyIfShipmentFailed' => 'ReturnImmediately'
58  );
59 
65  private static $dhlProducts = array();
66 
70  private function __clone() { /* VOID */ }
71 
75  private function __construct() { /* VOID */ }
76 
80  private static function init() {
81  self::setInit(true);
82 
83  // Initiates Products
85  $obj->setName('DHL Paket');
86  $obj->setMinLength(15);
87  $obj->setMaxLength(200);
88  $obj->setMinWidth(11);
89  $obj->setMaxWidth(200);
90  $obj->setMinHeight(1);
91  $obj->setMaxHeight(200);
92  $obj->setMaxWeight(31.5);
93  $obj->setServices(array(
94  'preferredNeighbourEnabled',
95  'preferredLocationEnabled',
96  'visualCheckOfAgeEnabled',
97  'personalHandover',
98  'namedPersonOnly',
99  'identCheckEnabled',
100  'preferredDayEnabled',
101  'preferredTimeEnabled',
102  'disableNeighbourDelivery',
103  'goGreen',
104  'additionalInsuranceEnabled',
105  'bulkyGoods',
106  'cashOnDeliveryEnabled',
107  'individualSenderRequiredmentsEnabled',
108  'packagingReturn',
109  'noticeNonDeliverability'
110  ));
111  self::addProduct($obj);
112 
114  $obj->setName('DHL Paket PRIO');
115  $obj->setMinLength(15);
116  $obj->setMaxLength(200);
117  $obj->setMinWidth(11);
118  $obj->setMaxWidth(200);
119  $obj->setMinHeight(1);
120  $obj->setMaxHeight(200);
121  $obj->setMaxWeight(31.5);
122  $obj->setServices(array(
123  'preferredNeighbourEnabled',
124  'preferredLocationEnabled',
125  'visualCheckOfAgeEnabled',
126  'namedPersonOnly',
127  'identCheckEnabled',
128  'preferredDayEnabled',
129  'preferredTimeEnabled',
130  'disableNeighbourDelivery',
131  'goGreen',
132  'additionalInsuranceEnabled',
133  'cashOnDeliveryEnabled',
134  'individualSenderRequiredmentsEnabled',
135  'packagingReturn',
136  'noticeNonDeliverability'
137  ));
138  self::addProduct($obj);
139 
141  $obj->setName('DHL Paket Taggleich');
142  $obj->setMinLength(15);
143  $obj->setMaxLength(200);
144  $obj->setMinWidth(11);
145  $obj->setMaxWidth(200);
146  $obj->setMinHeight(1);
147  $obj->setMaxHeight(200);
148  $obj->setMaxWeight(31.5);
149  $obj->setServices(array(
150  'preferredNeighbourEnabled',
151  'preferredLocationEnabled',
152  'visualCheckOfAgeEnabled',
153  'namedPersonOnly',
154  'identCheckEnabled',
155  'preferredDayEnabled',
156  'preferredTimeEnabled',
157  'disableNeighbourDelivery',
158  'goGreen',
159  'additionalInsuranceEnabled',
160  'bulkyGoods',
161  'cashOnDeliveryEnabled',
162  'individualSenderRequiredmentsEnabled',
163  'packagingReturn',
164  'noticeNonDeliverability',
165  'returnImmediatlyIfShipmentFailed'
166  ));
167  self::addProduct($obj);
168 
170  $obj->setName('DHL Paket International');
171  $obj->setMinLength(15);
172  $obj->setMaxLength(120);
173  $obj->setMinWidth(11);
174  $obj->setMaxWidth(60);
175  $obj->setMinHeight(1);
176  $obj->setMaxHeight(60);
177  $obj->setMaxWeight(31.5);
178  $obj->setServices(array(
179  'endorsementEnabled',
180  'returnReceipt',
181  'goGreen',
182  'additionalInsuranceEnabled',
183  'bulkyGoods',
184  'cashOnDeliveryEnabled',
185  'premium'
186  ));
187  self::addProduct($obj);
188 
190  $obj->setName('DHL Europapaket');
191  $obj->setMinLength(15);
192  $obj->setMaxLength(120);
193  $obj->setMinWidth(11);
194  $obj->setMaxWidth(60);
195  $obj->setMinHeight(3.5);
196  $obj->setMaxHeight(60);
197  $obj->setMaxWeight(31.5);
198  $obj->setServices(array(
199  'goGreen',
200  'additionalInsuranceEnabled'
201  ));
202  self::addProduct($obj);
203 
205  $obj->setName('DHL Paket Connect');
206  $obj->setMinLength(15);
207  $obj->setMaxLength(120);
208  $obj->setMinWidth(11);
209  $obj->setMaxWidth(60);
210  $obj->setMinHeight(3.5);
211  $obj->setMaxHeight(60);
212  $obj->setMaxWeight(31.5);
213  $obj->setServices(array(
214  'goGreen',
215  'additionalInsuranceEnabled',
216  'bulkyGoods'
217  ));
218  self::addProduct($obj);
219 
221  $obj->setName('DHL Kurier Taggleich');
222  $obj->setMinLength(15);
223  $obj->setMaxLength(200);
224  $obj->setMinWidth(11);
225  $obj->setMaxWidth(200);
226  $obj->setMinHeight(1);
227  $obj->setMaxHeight(200);
228  $obj->setMaxWeight(31.5);
229  $obj->setServices(array(
230  'preferredNeighbourEnabled',
231  'visualCheckOfAgeEnabled',
232  'endorsementEnabled',
233  'goGreen',
234  'dayOfDeliveryEnabled',
235  'deliveryTimeframeEnabled',
236  'shipmentHandlingEnabled',
237  'perishables',
238  'individualSenderRequiredmentsEnabled'
239  ));
240  self::addProduct($obj);
241 
243  $obj->setName('DHL Kurier Wunschzeit');
244  $obj->setMinLength(15);
245  $obj->setMaxLength(200);
246  $obj->setMinWidth(11);
247  $obj->setMaxWidth(200);
248  $obj->setMinHeight(1);
249  $obj->setMaxHeight(200);
250  $obj->setMaxWeight(31.5);
251  $obj->setServices(array(
252  'preferredNeighbourEnabled',
253  'visualCheckOfAgeEnabled',
254  'endorsementEnabled',
255  'goGreen',
256  'dayOfDeliveryEnabled',
257  'deliveryTimeframeEnabled',
258  'shipmentHandlingEnabled',
259  'perishables',
260  'individualSenderRequiredmentsEnabled'
261  ));
262  self::addProduct($obj);
263 
265  $obj->setName('DHL Paket Austria');
266  $obj->setAustria(true);
267  $obj->setMinLength(15);
268  $obj->setMaxLength(120);
269  $obj->setMinWidth(11);
270  $obj->setMaxWidth(60);
271  $obj->setMinHeight(1);
272  $obj->setMaxHeight(60);
273  $obj->setMaxWeight(31.5);
274  $obj->setServices(array(
275  'additionalInsuranceEnabled',
276  'bulkyGoods',
277  'cashOnDeliveryEnabled'
278  ));
279  self::addProduct($obj);
280 
282  $obj->setName('DHL Paket Connect');
283  $obj->setAustria(true);
284  $obj->setMinLength(15);
285  $obj->setMaxLength(120);
286  $obj->setMinWidth(11);
287  $obj->setMaxWidth(60);
288  $obj->setMinHeight(3.5);
289  $obj->setMaxHeight(60);
290  $obj->setMaxWeight(31.5);
291  $obj->setServices(array(
292  'additionalInsuranceEnabled',
293  'bulkyGoods',
294  'cashOnDeliveryEnabled'
295  ));
296  self::addProduct($obj);
297 
299  $obj->setName('DHL Paket International');
300  $obj->setAustria(true);
301  $obj->setMinLength(15);
302  $obj->setMaxLength(120);
303  $obj->setMinWidth(11);
304  $obj->setMaxWidth(60);
305  $obj->setMinHeight(1);
306  $obj->setMaxHeight(60);
307  $obj->setMaxWeight(31.5);
308  $obj->setServices(array(
309  'additionalInsuranceEnabled',
310  'bulkyGoods',
311  'cashOnDeliveryEnabled'
312  ));
313  self::addProduct($obj);
314  }
315 
321  private static function isInit() {
322  return self::$init;
323  }
324 
330  private static function setInit($init) {
331  self::$init = $init;
332  }
333 
339  public static function getDhlProducts() {
340  if(! self::isInit())
341  self::init();
342 
343  return self::$dhlProducts;
344  }
345 
351  private static function addProduct($product) {
352  self::$dhlProducts[$product->getType()] = $product;
353  }
354 
361  public static function getInfo($productType) {
362  if(! self::isInit())
363  self::init();
364 
365  if(! array_key_exists($productType, self::$dhlProducts))
366  return null;
367 
368  return self::$dhlProducts[$productType];
369  }
370 }
static getInfo($productType)