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
- Since:
1.0.0
- Deprecated:
2.0.0
- 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
- Since:
1.0.0
- 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- Since:
1.0.0
- 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:
- Since:
1.0.0
- 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- Since:
1.0.0
- 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)
- Since:
1.0.0
- public static Firstred\PostNL\Util\Util::compareGuzzleVersion(int|float|string $a, int|float|string $b)
- Parameters:
$a (int | float | string)
$b (int | float | string)
- Returns:
int
- Since:
1.0.0
- public static Firstred\PostNL\Util\Util::isAssociativeArray($array)
- Check if the given array is associative.
- Parameters:
$array (array)
- Returns:
bool
- Since:
2.0.0