diff --git a/src/Vies/Validator/ValidatorFR.php b/src/Vies/Validator/ValidatorFR.php index 9385a5d..0a8e557 100644 --- a/src/Vies/Validator/ValidatorFR.php +++ b/src/Vies/Validator/ValidatorFR.php @@ -93,7 +93,7 @@ private function validateOld(string $vatNumber): string return ""; } $checkVal .= "12"; - if (PHP_INT_SIZE === 4 && function_exists("bcmod")) { + if (PHP_INT_SIZE === 4 && extension_loaded('bcmath')) { $checkVal = (int) bcmod($checkVal, "97"); } else { $checkVal = intval($checkVal) % 97; @@ -119,10 +119,10 @@ private function validateNew(string $vatNumber): bool $checkCharacter = array_flip(str_split($this->alphabet)); $checkVal = ($checkCharacter[$vatNumber[0]] * $multiplier) + $checkCharacter[$vatNumber[1]] - $subStractor; - if (PHP_INT_SIZE === 4 && function_exists("bcmod")) { + if (PHP_INT_SIZE === 4 && extension_loaded("bcmath")) { return (int) bcmod(bcadd(substr($vatNumber, 2), strval(($checkVal / 11) + 1)), "11") === $checkVal % 11; } else { - return ((int)(intval(substr($vatNumber, 2)) + ($checkVal / 11) + 1) % 11) == $checkVal % 11; + return ((int) (intval(substr($vatNumber, 2)) + ($checkVal / 11) + 1) % 11) == $checkVal % 11; } } } diff --git a/src/Vies/Validator/ValidatorNL.php b/src/Vies/Validator/ValidatorNL.php index 92ceb96..f55f09a 100644 --- a/src/Vies/Validator/ValidatorNL.php +++ b/src/Vies/Validator/ValidatorNL.php @@ -130,7 +130,7 @@ protected function validateSoleProprietor(string $vatNumber): bool return $acc.$this->checkCharacter[$e]; }, '2321'); - if (PHP_INT_SIZE === 4 && function_exists('bcmod')) { + if (PHP_INT_SIZE === 4 && extension_loaded('bcmath')) { return bcmod($sumBase, '97') === '1'; } else { return ((int) $sumBase % 97) === 1; diff --git a/src/Vies/Validator/ValidatorSK.php b/src/Vies/Validator/ValidatorSK.php index 9c3a048..da923dc 100644 --- a/src/Vies/Validator/ValidatorSK.php +++ b/src/Vies/Validator/ValidatorSK.php @@ -41,7 +41,7 @@ public function validate(string $vatNumber): bool return false; } - if (PHP_INT_SIZE === 4 && function_exists('bcmod')) { + if (PHP_INT_SIZE === 4 && extension_loaded("bcmath")) { return bcmod($vatNumber, '11') === '0'; } else { return $vatNumber % 11 == 0;