Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AbstractDhl.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Dhl\Model;
7 
9 
10 abstract class AbstractDhl extends AbstractCarrierOnline
11 {
16 
21 
25  const REQUEST_DATE_FORMAT = 'Y-m-d';
26 
32  protected function _getShipDate()
33  {
34  return $this->_determineShippingDay($this->getConfigData('shipment_days'), date(self::REQUEST_DATE_FORMAT));
35  }
36 
44  protected function _determineShippingDay($shippingDays, $date)
45  {
46  if (empty($shippingDays)) {
47  return $date;
48  }
49 
50  $shippingDays = explode(',', $shippingDays);
51 
52  $i = -1;
53  do {
54  $i++;
55  $weekday = date('D', strtotime("{$date} +{$i} day"));
56  } while (!in_array($weekday, $shippingDays) && $i < 10);
57 
58  return date(self::REQUEST_DATE_FORMAT, strtotime("{$date} +{$i} day"));
59  }
60 }
_determineShippingDay($shippingDays, $date)
Definition: AbstractDhl.php:44
$i
Definition: gallery.phtml:31