| Total Complexity | 4 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class RegionAreaRule implements ValidationRule |
||
| 13 | { |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Run the validation rule. |
||
| 17 | * |
||
| 18 | * @param string $attribute |
||
| 19 | * @param mixed $value |
||
| 20 | * @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail |
||
| 21 | * @return void |
||
| 22 | */ |
||
| 23 | public function validate(string $attribute, mixed $value, \Closure $fail): void |
||
| 24 | { |
||
| 25 | if (!$this->passes($attribute, $value)) { |
||
| 26 | $fail($this->message()); |
||
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Determine if the validation rule passes. |
||
| 32 | * |
||
| 33 | * @param string $attribute |
||
| 34 | * @param mixed $value |
||
| 35 | * @return bool |
||
| 36 | */ |
||
| 37 | public function passes($attribute, $value) |
||
|
|
|||
| 38 | { |
||
| 39 | return (new RegionArea($value))->isValid(); |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Get the validation error message. |
||
| 44 | * |
||
| 45 | * @return string|array |
||
| 46 | */ |
||
| 47 | public function message() |
||
| 50 | } |
||
| 51 | } |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.