Skip to content

Commit

Permalink
Updated splitaddress helper to cut the housenumber at 45 characters
Browse files Browse the repository at this point in the history
  • Loading branch information
andy committed Feb 1, 2019
1 parent 617259f commit c21dff9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static function getIp()
}
$arrIp = explode(',', $the_ip);

return filter_var(trim(trim($arrIp[0]),'[]'), FILTER_VALIDATE_IP);
return filter_var(trim(trim($arrIp[0]), '[]'), FILTER_VALIDATE_IP);
}

/**
Expand All @@ -99,7 +99,7 @@ public static function redirect($url)
private static function nearest($number, $numbers)
{
$output = false;
$number = (int) $number;
$number = (int)$number;
if (is_array($numbers) && count($numbers) >= 1) {
$NDat = array();
foreach ($numbers as $n) {
Expand Down Expand Up @@ -144,6 +144,7 @@ public static function calculateTaxPercentage($amountInclTax, $taxAmount)

return ($taxAmount / $amountExclTax) * 100;
}

/**
* Determine the tax class to send to Pay.nl
*
Expand Down Expand Up @@ -197,7 +198,7 @@ public static function splitAddress($strAddress)
$strStreetName = implode('', $a);
}

return array($strStreetName, $strStreetNumber);
return array($strStreetName, substr($strStreetNumber, 0, 45));
}

/**
Expand All @@ -209,7 +210,7 @@ public static function splitAddress($strAddress)
public static function getBaseUrl()
{
$protocol = isset($_SERVER['HTTPS']) ? 'https' : 'http';
$url = $protocol . '://' . $_SERVER['SERVER_NAME'] .':'.$_SERVER['SERVER_PORT']. $_SERVER['REQUEST_URI'];
$url = $protocol . '://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'];

// cut at last '/' (we dont want to see index.php)
return substr($url, 0, strrpos($url, '/'));
Expand Down

0 comments on commit c21dff9

Please sign in to comment.