Skip to content

Commit

Permalink
Beautify foreach loop for HU VAT
Browse files Browse the repository at this point in the history
  • Loading branch information
danielebarbaro committed Nov 13, 2024
1 parent 5509624 commit 2822cac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/VatValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ private function validateHuVat(string $vat): bool
$weights = [9, 7, 3, 1, 9, 7, 3];
$sum = 0;

for ($i = 0; $i < 7; $i++) {
$sum += (int) $vat[$i] * $weights[$i];
foreach ($weights as $i => $weight) {
$sum += (int) $vat[$i] * $weight;
}

$calculatedChecksum = (10 - ($sum % 10)) % 10;
Expand Down

0 comments on commit 2822cac

Please sign in to comment.