@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | $digits = str_split($imei); // Get digits |
| 25 | 25 | $imei_last = array_pop($digits); // Remove last digit, and store it |
| 26 | - $log = []; |
|
| 26 | + $log = [ ]; |
|
| 27 | 27 | |
| 28 | 28 | foreach ($digits as $key => $n) { |
| 29 | 29 | if ($key & 1) { |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $n = array_sum($double); // Sum double digits |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - $log[] = $n; // Append log |
|
| 34 | + $log[ ] = $n; // Append log |
|
| 35 | 35 | } |
| 36 | 36 | $sum = array_sum($log) * 9; // Sum log & multiply by 9 |
| 37 | 37 | |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public function passes($attribute, $value) |
| 18 | 18 | { |
| 19 | - if (! is_string($value)) { |
|
| 19 | + if ( ! is_string($value)) { |
|
| 20 | 20 | return false; |
| 21 | 21 | } |
| 22 | 22 | |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | $cardToArr = str_split($value); |
| 19 | 19 | $cardTotal = 0; |
| 20 | 20 | for ($i = 0; $i < 16; $i++) { |
| 21 | - $c = (int) $cardToArr[$i]; |
|
| 21 | + $c = (int) $cardToArr[ $i ]; |
|
| 22 | 22 | if ($i % 2 === 0) { |
| 23 | 23 | $cardTotal += (($c * 2 > 9) ? ($c * 2) - 9 : ($c * 2)); |
| 24 | 24 | } else { |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function passes($attribute, $value) |
| 17 | 17 | { |
| 18 | - if (! preg_match('/^\d{10}$/', $value)) { |
|
| 18 | + if ( ! preg_match('/^\d{10}$/', $value)) { |
|
| 19 | 19 | return false; |
| 20 | 20 | } |
| 21 | 21 | |
@@ -167,7 +167,7 @@ |
||
| 167 | 167 | */ |
| 168 | 168 | private ?array $countries; |
| 169 | 169 | |
| 170 | - public function __construct(array|string $countries = []) |
|
| 170 | + public function __construct(array | string $countries = [ ]) |
|
| 171 | 171 | { |
| 172 | 172 | $this->setCountries(func_get_args()); |
| 173 | 173 | } |
@@ -12,17 +12,17 @@ discard block |
||
| 12 | 12 | private function setCountries(?array $countries) |
| 13 | 13 | { |
| 14 | 14 | if (empty($countries)) { |
| 15 | - $this->countries = []; |
|
| 15 | + $this->countries = [ ]; |
|
| 16 | 16 | |
| 17 | 17 | return; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - if (is_array($countries[0])) { |
|
| 21 | - $countries = $countries[0]; |
|
| 20 | + if (is_array($countries[ 0 ])) { |
|
| 21 | + $countries = $countries[ 0 ]; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | foreach ($countries as $country) { |
| 25 | - $this->countries[] = $country; |
|
| 25 | + $this->countries[ ] = $country; |
|
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | private function isIbanValid(string $iban) |
| 35 | 35 | { |
| 36 | - if (! $this->checkIbanFormat($iban)) { |
|
| 36 | + if ( ! $this->checkIbanFormat($iban)) { |
|
| 37 | 37 | return false; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | private function isCountryValid(string $country, string $ibanCountryCode) |
| 128 | 128 | { |
| 129 | 129 | return ! empty($country) |
| 130 | - && isset($this->ibanLengthByCountry[$country]) |
|
| 130 | + && isset($this->ibanLengthByCountry[ $country ]) |
|
| 131 | 131 | && $ibanCountryCode === $country; |
| 132 | 132 | } |
| 133 | 133 | |
@@ -138,6 +138,6 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | private function isIbanLengthValid(string $iban, string $ibanCountryCode) |
| 140 | 140 | { |
| 141 | - return strlen($iban) === $this->ibanLengthByCountry[$ibanCountryCode]; |
|
| 141 | + return strlen($iban) === $this->ibanLengthByCountry[ $ibanCountryCode ]; |
|
| 142 | 142 | } |
| 143 | 143 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | public function callPhoneValidator(): array |
| 198 | 198 | { |
| 199 | - $results = []; |
|
| 199 | + $results = [ ]; |
|
| 200 | 200 | $codes = explode(',', $this->code); |
| 201 | 201 | $codes = array_map('strtoupper', $codes); |
| 202 | 202 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | $methodName = 'validate'.$code; |
| 205 | 205 | |
| 206 | 206 | if (method_exists($this, $methodName)) { |
| 207 | - $results[$code] = $this->{$methodName}(); |
|
| 207 | + $results[ $code ] = $this->{$methodName}(); |
|
| 208 | 208 | } else { |
| 209 | 209 | throw new \BadMethodCallException("Validator method '{$methodName}' does not exist."); |
| 210 | 210 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | $reverse = strrev($value); |
| 23 | 23 | |
| 24 | 24 | for ($i = 0; $i < $numLength; $i++) { |
| 25 | - $currentNum = intval($reverse[$i]); |
|
| 25 | + $currentNum = intval($reverse[ $i ]); |
|
| 26 | 26 | if ($i % 2 == 1) { |
| 27 | 27 | $currentNum *= 2; |
| 28 | 28 | if ($currentNum > 9) { |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | if (empty($value)) |
| 19 | 19 | return false; |
| 20 | 20 | |
| 21 | - if(strlen($value) != 11) |
|
| 21 | + if (strlen($value) != 11) |
|
| 22 | 22 | return false; |
| 23 | 23 | |
| 24 | 24 | $invalidIds = [ |
@@ -37,17 +37,17 @@ discard block |
||
| 37 | 37 | if (in_array($value, $invalidIds)) |
| 38 | 38 | return false; |
| 39 | 39 | |
| 40 | - $multiplier = [29, 27, 23, 19, 17, 29, 27, 23, 19, 17]; |
|
| 40 | + $multiplier = [ 29, 27, 23, 19, 17, 29, 27, 23, 19, 17 ]; |
|
| 41 | 41 | $checkNumber = substr($value, 10, 1); |
| 42 | 42 | $decimalNumber = substr($value, 9, 1); |
| 43 | 43 | $multiplication = $decimalNumber + 2; |
| 44 | 44 | $sum = 0; |
| 45 | 45 | |
| 46 | 46 | for ($i = 0; $i < 10; $i++) |
| 47 | - $sum += (substr($value, $i, 1) + $multiplication) * $multiplier[$i]; |
|
| 47 | + $sum += (substr($value, $i, 1) + $multiplication) * $multiplier[ $i ]; |
|
| 48 | 48 | |
| 49 | 49 | $remain = $sum % 11; |
| 50 | - if($remain == 10) |
|
| 50 | + if ($remain == 10) |
|
| 51 | 51 | $remain = 0; |
| 52 | 52 | |
| 53 | 53 | if ($remain == $checkNumber) |
@@ -15,11 +15,13 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |