From af3907e84421dafd569af0f1bcd022307047fe50 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 1 Jul 2023 02:13:17 +0300 Subject: [PATCH] Removed redundant condition --- src/Services/Parser.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Services/Parser.php b/src/Services/Parser.php index 1aeabaa..e030ce4 100644 --- a/src/Services/Parser.php +++ b/src/Services/Parser.php @@ -21,14 +21,11 @@ public function parse(string $number): array if (($length - $i) % 2) { $digit *= 2; - - $checksum += ($digit <= 9 ? $digit : $digit - 9); - } - else { - $checksum += $digit; } + + $checksum += ($digit <= 9 ? $digit : $digit - 9); } - return [$checksum, $checksum - $number[$length]]; + return [$checksum, $checksum - (int) $number[$length]]; } }