@@ -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 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | public function validate(string $attribute, mixed $value, Closure $fail): void |
19 | 19 | { |
20 | - if (! preg_match('/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/', $value)) { |
|
20 | + if ( ! preg_match('/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/', $value)) { |
|
21 | 21 | |
22 | 22 | $fail('validate.url')->translate(); |
23 | 23 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | private array $countries; |
168 | 168 | |
169 | - public function __construct(array|string $countries = []) |
|
169 | + public function __construct(array | string $countries = [ ]) |
|
170 | 170 | { |
171 | 171 | $this->setCountries(func_get_args()); |
172 | 172 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function validate(string $attribute, mixed $value, Closure $fail): void |
183 | 183 | { |
184 | - if (! $this->isIbanValid($value)) { |
|
184 | + if ( ! $this->isIbanValid($value)) { |
|
185 | 185 | |
186 | 186 | $fail('validate.iban')->translate(); |
187 | 187 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function validate(string $attribute, mixed $value, Closure $fail): void |
19 | 19 | { |
20 | - if (! $this->isImeiValid($value)) { |
|
20 | + if ( ! $this->isImeiValid($value)) { |
|
21 | 21 | |
22 | 22 | $fail('validate.imei')->translate(); |
23 | 23 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | $digits = str_split($imei); // Get digits |
41 | 41 | $imei_last = array_pop($digits); // Remove last digit, and store it |
42 | - $log = []; |
|
42 | + $log = [ ]; |
|
43 | 43 | |
44 | 44 | foreach ($digits as $key => $n) { |
45 | 45 | if ($key & 1) { |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $n = array_sum($double); // Sum double digits |
48 | 48 | } |
49 | 49 | |
50 | - $log[] = $n; // Append log |
|
50 | + $log[ ] = $n; // Append log |
|
51 | 51 | } |
52 | 52 | $sum = array_sum($log) * 9; // Sum log & multiply by 9 |
53 | 53 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | public function validate(string $attribute, mixed $value, Closure $fail): void |
19 | 19 | { |
20 | - if (! preg_match('/^[A-Z]{2}[0-9]{2}[A-Z]{2}[0-9]{4}$/', $value)) { |
|
20 | + if ( ! preg_match('/^[A-Z]{2}[0-9]{2}[A-Z]{2}[0-9]{4}$/', $value)) { |
|
21 | 21 | |
22 | 22 | $fail('validate.car-number')->translate(); |
23 | 23 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | public function validate(string $attribute, mixed $value, Closure $fail): void |
19 | 19 | { |
20 | - if (! preg_match('/\/+$/', $value)) { |
|
20 | + if ( ! preg_match('/\/+$/', $value)) { |
|
21 | 21 | |
22 | 22 | $fail('validate.slash-end-of-string')->translate(); |
23 | 23 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | public function validate(string $attribute, mixed $value, Closure $fail): void |
19 | 19 | { |
20 | - if (! preg_match('/^(?:\p{Ll}+\-)*\p{Ll}+$/u', $value)) { |
|
20 | + if ( ! preg_match('/^(?:\p{Ll}+\-)*\p{Ll}+$/u', $value)) { |
|
21 | 21 | |
22 | 22 | $fail('validate.kebab-case')->translate(); |
23 | 23 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | public function validate(string $attribute, mixed $value, Closure $fail): void |
19 | 19 | { |
20 | - if (! preg_match('/[0-7][0-9A-HJKMNP-TV-Z]{25}/', $value)) { |
|
20 | + if ( ! preg_match('/[0-7][0-9A-HJKMNP-TV-Z]{25}/', $value)) { |
|
21 | 21 | |
22 | 22 | $fail('validate.ulid')->translate(); |
23 | 23 | } |