| Total Complexity | 4 |
| Total Lines | 19 |
| Duplicated Lines | 0 % |
| Coverage | 62.5% |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class Required extends Rule |
||
| 15 | { |
||
| 16 | private string $message = 'Value cannot be blank.'; |
||
| 17 | |||
| 18 | 3 | protected function validateValue($value, DataSetInterface $dataSet = null): Result |
|
| 19 | { |
||
| 20 | 3 | $result = new Result(); |
|
| 21 | |||
| 22 | 3 | if ($this->isEmpty(is_string($value) ? trim($value) : $value)) { |
|
| 23 | 1 | $result->addError($this->translateMessage($this->message)); |
|
| 24 | } |
||
| 25 | |||
| 26 | 3 | return $result; |
|
| 27 | } |
||
| 28 | |||
| 29 | public function message(string $message): self |
||
| 33 | } |
||
| 34 | } |
||
| 35 |