Util¶
-
class
Firstred\PostNL\Util\Util¶ - Class Util.
Summary¶
Methods¶
Constants¶
-
ERROR_MARGIN = 2
Methods¶
-
public static
Firstred\PostNL\Util\Util::urlEncode($arr, $prefix=null)¶ - Parameters
$arr (array) a map of param keys to values
$prefix (string | null)
- Returns
string a querystring, essentially
-
public static
Firstred\PostNL\Util\Util::getPdfSizeAndOrientation($pdf)¶ - Parameters
$pdf (string) Raw PDF string
- Returns
array | false | string Returns an array with the dimensions or ISO size and orientation The orientation is in FPDF format, so L for Landscape and P for Portrait Sizes are in mm
-
public static
Firstred\PostNL\Util\Util::getDeliveryDate($deliveryDate, $mondayDelivery=false, $sundayDelivery=false)¶ - Offline delivery date calculation.
- Parameters
$deliveryDate (string) Delivery date in any format accepted by DateTime
$mondayDelivery (bool) Sunday sorting/Monday delivery enabled
$sundayDelivery (bool) Sunday delivery enabled
- Returns
string (format: `Y-m-d H:i:s`)
- Throws
\Exception
-
public static
Firstred\PostNL\Util\Util::getShippingDate( $deliveryDate, $days=\[0 =\> false, 1 =\> true, 2 =\> true, 3 =\> true, 4 =\> true, 5 =\> true, 6 =\> true\])¶ - Offline shipping date calculation.
- Parameters
$deliveryDate (string)
$days (array)
- Returns
string
- Throws
-
public static
Firstred\PostNL\Util\Util::getShippingDaysRemaining($shippingDate, $preferredDeliveryDate)¶ - Calculates amount of days remainingi.e. preferred delivery date the day tomorrow => today = 0i.e. preferred delivery date the day after tomorrow => today + tomorrow = 1i.e. preferred delivery date the day after tomorrow, but one holiday => today + holiday = 0.0 means: should ship today< 0 means: should've shipped in the pastanything higher means: you've got some more time
- Parameters
$shippingDate (string) Shipping date (format: Y-m-d H:i:s)
$preferredDeliveryDate (string) Customer preference
- Returns
int
- Throws
\Exception
-
protected static
Firstred\PostNL\Util\Util::getHolidaysForYear($year)¶ - Get an array with all Dutch holidays for the given year.
- Parameters
$year (string)
- Returns
array Credits to @tvlooy (https://gist.github.com/tvlooy/1894247)
- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception- Throws
\Exception