Passed
Pull Request — 1.x (#77)
by
unknown
11:51
created
src/Rules/ValidIranCompanyId.php 1 patch
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,11 +15,13 @@  discard block
 block discarded – undo
15 15
      */
16 16
     public function passes($attribute, $value)
17 17
     {
18
-        if (empty($value))
19
-            return false;
18
+        if (empty($value)) {
19
+                    return false;
20
+        }
20 21
 
21
-        if(strlen($value) != 11)
22
-            return false;
22
+        if(strlen($value) != 11) {
23
+                    return false;
24
+        }
23 25
 
24 26
         $invalidIds = [
25 27
             00000000000,
@@ -34,8 +36,9 @@  discard block
 block discarded – undo
34 36
             99999999999
35 37
         ];
36 38
 
37
-        if (in_array($value, $invalidIds)) 
38
-            return false;
39
+        if (in_array($value, $invalidIds)) {
40
+                    return false;
41
+        }
39 42
         
40 43
         $multiplier = [29, 27, 23, 19, 17, 29, 27, 23, 19, 17];
41 44
         $checkNumber = substr($value, 10, 1);
@@ -43,15 +46,18 @@  discard block
 block discarded – undo
43 46
         $multiplication = $decimalNumber + 2;
44 47
         $sum = 0;
45 48
 
46
-        for ($i = 0; $i < 10; $i++)
47
-            $sum += (substr($value, $i, 1) + $multiplication) * $multiplier[$i];
49
+        for ($i = 0; $i < 10; $i++) {
50
+                    $sum += (substr($value, $i, 1) + $multiplication) * $multiplier[$i];
51
+        }
48 52
 
49 53
         $remain = $sum % 11;
50
-        if($remain == 10)
51
-            $remain = 0;
54
+        if($remain == 10) {
55
+                    $remain = 0;
56
+        }
52 57
 
53
-        if ($remain == $checkNumber)
54
-            return true;
58
+        if ($remain == $checkNumber) {
59
+                    return true;
60
+        }
55 61
         
56 62
         return false;
57 63
     }
Please login to merge, or discard this patch.