Skip to content

Commit

Permalink
Merge pull request #43 from MidnightDesign/patch-2
Browse files Browse the repository at this point in the history
Refactor IBAN#local_bcmod()
  • Loading branch information
jschaedl authored Jan 2, 2017
2 parents 31d08db + 7a494b0 commit 5ffc987
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions library/IBAN/Core/IBAN.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,18 @@ private function normalize($iban)

private function local_bcmod($x, $y)
{
if (!function_exists('bcmod')) {
$take = 5;
$mod = '';

do {
$a = (int)$mod . substr($x, 0, $take);
$x = substr($x, $take);
$mod = $a % $y;
} while (strlen($x));

return (string)$mod;
} else {
if (function_exists('bcmod')) {
return bcmod($x, $y);
}
$take = 5;
$mod = '';

do {
$a = (int)$mod . substr($x, 0, $take);
$x = substr($x, $take);
$mod = $a % $y;
} while (strlen($x));

return (string)$mod;
}
}

0 comments on commit 5ffc987

Please sign in to comment.