@@ -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 | |
@@ -82,8 +82,8 @@ |
||
| 82 | 82 | */ |
| 83 | 83 | private function loadValidations() |
| 84 | 84 | { |
| 85 | - foreach (config('laravel-validate.rules', []) as $rule) { |
|
| 86 | - Validator::extend('validate-'.$rule['name'], function ($attribute, $value, $parameters, $validator) use ($rule) { |
|
| 85 | + foreach (config('laravel-validate.rules', [ ]) as $rule) { |
|
| 86 | + Validator::extend('validate-'.$rule[ 'name' ], function($attribute, $value, $parameters, $validator) use ($rule) { |
|
| 87 | 87 | $rule = new $rule(...$parameters); |
| 88 | 88 | |
| 89 | 89 | return $rule->passes($attribute, $value); |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | private array $countries; |
| 163 | 163 | |
| 164 | - public function __construct(array|string $countries = []) |
|
| 164 | + public function __construct(array | string $countries = [ ]) |
|
| 165 | 165 | { |
| 166 | 166 | $this->setCountries(func_get_args()); |
| 167 | 167 | } |
@@ -193,19 +193,19 @@ discard block |
||
| 193 | 193 | * |
| 194 | 194 | * @return void |
| 195 | 195 | */ |
| 196 | - private function setCountries(array|null $countries) |
|
| 196 | + private function setCountries(array | null $countries) |
|
| 197 | 197 | { |
| 198 | 198 | if (empty($countries)) { |
| 199 | - $this->countries = []; |
|
| 199 | + $this->countries = [ ]; |
|
| 200 | 200 | return; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - if (is_array($countries[0])) { |
|
| 204 | - $countries = $countries[0]; |
|
| 203 | + if (is_array($countries[ 0 ])) { |
|
| 204 | + $countries = $countries[ 0 ]; |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | foreach ($countries as $country) { |
| 208 | - $this->countries[] = $country; |
|
| 208 | + $this->countries[ ] = $country; |
|
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | 211 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | private function isIbanValid(string $iban) |
| 219 | 219 | { |
| 220 | - if (! $this->checkIbanFormat($iban)) { |
|
| 220 | + if ( ! $this->checkIbanFormat($iban)) { |
|
| 221 | 221 | return false; |
| 222 | 222 | } |
| 223 | 223 | |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | private function isCountryValid(string $country, string $ibanCountryCode) |
| 318 | 318 | { |
| 319 | 319 | return ! empty($country) |
| 320 | - && isset($this->ibanLengthByCountry[$country]) |
|
| 320 | + && isset($this->ibanLengthByCountry[ $country ]) |
|
| 321 | 321 | && $ibanCountryCode === $country; |
| 322 | 322 | } |
| 323 | 323 | |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | private function isIbanLengthValid(string $iban, string $ibanCountryCode) |
| 330 | 330 | { |
| 331 | - return strlen($iban) === $this->ibanLengthByCountry[$ibanCountryCode]; |
|
| 331 | + return strlen($iban) === $this->ibanLengthByCountry[ $ibanCountryCode ]; |
|
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | |