@@ -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 |
@@ -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 { |
@@ -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 | } |
@@ -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) { |
@@ -13,17 +13,17 @@ discard block |
||
13 | 13 | private function setCountries(?array $countries): void |
14 | 14 | { |
15 | 15 | if (empty($countries)) { |
16 | - $this->countries = []; |
|
16 | + $this->countries = [ ]; |
|
17 | 17 | |
18 | 18 | return; |
19 | 19 | } |
20 | 20 | |
21 | - if (is_array($countries[0])) { |
|
22 | - $countries = $countries[0]; |
|
21 | + if (is_array($countries[ 0 ])) { |
|
22 | + $countries = $countries[ 0 ]; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | foreach ($countries as $country) { |
26 | - $this->countries[] = $country; |
|
26 | + $this->countries[ ] = $country; |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | private function isIbanValid(string $iban): bool |
37 | 37 | { |
38 | - if (! $this->checkIbanFormat($iban)) { |
|
38 | + if ( ! $this->checkIbanFormat($iban)) { |
|
39 | 39 | return false; |
40 | 40 | } |
41 | 41 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | private function isCountryValid(string $country, string $ibanCountryCode): bool |
136 | 136 | { |
137 | 137 | return ! empty($country) |
138 | - && isset($this->ibanLengthByCountry[$country]) |
|
138 | + && isset($this->ibanLengthByCountry[ $country ]) |
|
139 | 139 | && $ibanCountryCode === $country; |
140 | 140 | } |
141 | 141 | |
@@ -148,6 +148,6 @@ discard block |
||
148 | 148 | */ |
149 | 149 | private function isIbanLengthValid(string $iban, string $ibanCountryCode): bool |
150 | 150 | { |
151 | - return strlen($iban) === $this->ibanLengthByCountry[$ibanCountryCode]; |
|
151 | + return strlen($iban) === $this->ibanLengthByCountry[ $ibanCountryCode ]; |
|
152 | 152 | } |
153 | 153 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | */ |
17 | 17 | public function passes($attribute, $value): bool |
18 | 18 | { |
19 | - if (! is_string($value)) { |
|
19 | + if ( ! is_string($value)) { |
|
20 | 20 | return false; |
21 | 21 | } |
22 | 22 |
@@ -11,7 +11,7 @@ |
||
11 | 11 | */ |
12 | 12 | public function passes($attribute, $value): bool |
13 | 13 | { |
14 | - if (! preg_match('/^\d{10}$/', $value)) { |
|
14 | + if ( ! preg_match('/^\d{10}$/', $value)) { |
|
15 | 15 | return false; |
16 | 16 | } |
17 | 17 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | /** |
11 | 11 | * Country Validate classes. |
12 | 12 | */ |
13 | - protected static array $validators = []; |
|
13 | + protected static array $validators = [ ]; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Add new country validator. |
@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public static function addValidator(string $code, string $validator): void |
21 | 21 | { |
22 | - if (! new $validator instanceof CountryPhoneValidator) { |
|
22 | + if ( ! new $validator instanceof CountryPhoneValidator) { |
|
23 | 23 | throw new RuntimeException('The validator is not instance of CountryPhoneValidator'); |
24 | 24 | } |
25 | 25 | |
26 | - self::$validators[$code] = $validator; |
|
26 | + self::$validators[ $code ] = $validator; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public static function callPhoneValidator(string $code, $value) |
33 | 33 | { |
34 | - if (isset(self::$validators[$code])) { |
|
35 | - return (new self::$validators[$code])->validate($value); |
|
34 | + if (isset(self::$validators[ $code ])) { |
|
35 | + return (new self::$validators[ $code ])->validate($value); |
|
36 | 36 | } else { |
37 | 37 | throw new \BadMethodCallException("Validator method for '$code' does not exist."); |
38 | 38 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public function passes($attribute, $value): bool |
13 | 13 | { |
14 | - if (! is_numeric($value)) { |
|
14 | + if ( ! is_numeric($value)) { |
|
15 | 15 | return false; |
16 | 16 | } |
17 | 17 | |
@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | $number = explode('.', $number); |
20 | 20 | |
21 | 21 | // Check if there is a decimal part and it's not zero |
22 | - if (isset($number[1]) && $number[1] != 0) { |
|
22 | + if (isset($number[ 1 ]) && $number[ 1 ] != 0) { |
|
23 | 23 | return false; |
24 | 24 | } |
25 | 25 | |
26 | - $number = $number[0]; |
|
26 | + $number = $number[ 0 ]; |
|
27 | 27 | |
28 | 28 | if (extension_loaded('gmp')) { |
29 | 29 | return gmp_cmp(gmp_mod($number, '2'), '0') !== 0; |