Cleanup, added docs & RC 2
This commit is contained in:
@ -16,7 +16,7 @@ namespace Inforbank\Application\Helper;
|
||||
|
||||
class IBAN
|
||||
{
|
||||
private function wordToNumbers($word)
|
||||
private static function wordToNumbers($word)
|
||||
{
|
||||
$newword = "";
|
||||
$wordarray = str_split($word);
|
||||
@ -30,7 +30,7 @@ class IBAN
|
||||
return $newword;
|
||||
}
|
||||
|
||||
private function getCheckDigits($bignum)
|
||||
private static function getCheckDigits($bignum)
|
||||
{
|
||||
//Modulo staartdeling
|
||||
$modulo97 = (int)substr($bignum, 0, 6);
|
||||
@ -48,7 +48,7 @@ class IBAN
|
||||
return $checkdigits;
|
||||
}
|
||||
|
||||
public function isValidIBAN($iban)
|
||||
public static function isValidIBAN($iban)
|
||||
{
|
||||
$iban = str_replace(" ", "", $iban);
|
||||
$landcode = substr($iban, 0, 2);
|
||||
@ -56,38 +56,38 @@ class IBAN
|
||||
$identificatie = substr($iban, 4);
|
||||
$identificatie .= $landcode;
|
||||
$identificatie .= "00";
|
||||
$nummer = $this->wordToNumbers($identificatie);
|
||||
return $controle == $this->getCheckDigits($nummer);
|
||||
$nummer = self::wordToNumbers($identificatie);
|
||||
return $controle == self::getCheckDigits($nummer);
|
||||
}
|
||||
|
||||
public function getRekeningNummer($iban)
|
||||
public static function getRekeningNummer($iban)
|
||||
{
|
||||
return substr(str_replace(" ", "", $iban), 8);
|
||||
}
|
||||
|
||||
public function getBank($iban)
|
||||
public static function getBank($iban)
|
||||
{
|
||||
return substr(str_replace(" ", "", $iban), 4, 4);
|
||||
}
|
||||
|
||||
public function getLand($iban)
|
||||
public static function getLand($iban)
|
||||
{
|
||||
return substr(str_replace(" ", "", $iban), 0, 2);
|
||||
}
|
||||
|
||||
public function getIBAN($rekeningnr)
|
||||
public static function getIBAN($rekeningnr)
|
||||
{
|
||||
$landcode = "NL"; // NL in vertaling
|
||||
$landnumber = $this->wordToNumbers($landcode);
|
||||
$landnumber = self::wordToNumbers($landcode);
|
||||
|
||||
|
||||
$bankcode = "INFO";
|
||||
$banknumber = $this->wordToNumbers($bankcode);
|
||||
$banknumber = self::wordToNumbers($bankcode);
|
||||
|
||||
$rekeningnr = str_pad($rekeningnr, 10, 0, STR_PAD_LEFT);
|
||||
|
||||
$bignum = $banknumber . $rekeningnr . $landnumber . "00";
|
||||
$checkdigits = $this->getCheckDigits($bignum);
|
||||
$checkdigits = self::getCheckDigits($bignum);
|
||||
|
||||
$rekeningnrarr = str_split($rekeningnr, 4);
|
||||
return $landcode.$checkdigits." ".$bankcode." ".$rekeningnrarr[0]." ".$rekeningnrarr[1]." ".$rekeningnrarr[2];
|
||||
|
Reference in New Issue
Block a user