IsoCodes icon indicating copy to clipboard operation
IsoCodes copied to clipboard

Convert three assignment statements to the usage of combined operators

Open elfring opened this issue 4 years ago • 0 comments

:eyes: Some source code analysis tools can help to find opportunities for improving software components. :thought_balloon: I propose to increase the usage of combined operators accordingly.

diff --git a/src/IsoCodes/CreditCard.php b/src/IsoCodes/CreditCard.php
index b663322..3fd260e 100644
--- a/src/IsoCodes/CreditCard.php
+++ b/src/IsoCodes/CreditCard.php
@@ -35,7 +35,7 @@ class CreditCard implements IsoCodeInterface
             if ((($length - $i) % 2) == 0) {
                 $digit = (int) $digit * 2;
                 if ($digit > 9) {
-                    $digit = $digit - 9;
+                    $digit -= 9;
                 }
             }
             $tot += (int) $digit;
diff --git a/src/IsoCodes/Iban.php b/src/IsoCodes/Iban.php
index 4bb97c8..52d9a9b 100644
--- a/src/IsoCodes/Iban.php
+++ b/src/IsoCodes/Iban.php
@@ -110,7 +110,7 @@ class Iban implements IsoCodeInterface
             return false;
         }
         // Fetch needed string for validation
-        $check = $check.substr($iban, 0, 4);
+        $check .= substr($iban, 0, 4);
         // Replace characters by decimal values
         $check = str_replace(
             ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'],
diff --git a/src/IsoCodes/Iswc.php b/src/IsoCodes/Iswc.php
index 9ead1a7..82a8394 100644
--- a/src/IsoCodes/Iswc.php
+++ b/src/IsoCodes/Iswc.php
@@ -28,7 +28,7 @@ class Iswc extends Luhn implements IsoCodeInterface
         $sum = 1;
 
         for ($i = 1; $i <= 9; ++$i) {
-            $sum = $sum + $i * (int) $iswc[$i];
+            $sum += $i * (int) $iswc[$i];
         }
 
         $rem = $sum % 10;

elfring avatar Nov 25 '21 20:11 elfring