| Conditions | 5 |
| Paths | 5 |
| Total Lines | 22 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 9 | public function validate($attribute, $value, $params, $validator): bool |
||
|
|
|||
| 10 | { |
||
| 11 | $value = $this->normalizePayload($value); |
||
| 12 | |||
| 13 | foreach([MediaRequest::NEW, MediaRequest::REPLACE] as $type) { |
||
| 14 | if(is_array($value[$type]) && !empty($value[$type])) { |
||
| 15 | return true; |
||
| 16 | } |
||
| 17 | } |
||
| 18 | |||
| 19 | $validator->setCustomMessages([ |
||
| 20 | 'filefield_required' => 'De :attribute is verplicht.', |
||
| 21 | ]); |
||
| 22 | |||
| 23 | if(!isset($validator->customAttributes[$attribute])) { |
||
| 24 | $validator->addCustomAttributes([ |
||
| 25 | $attribute => 'afbeelding', |
||
| 26 | ]); |
||
| 27 | } |
||
| 28 | |||
| 29 | |||
| 30 | return false; |
||
| 31 | } |
||
| 33 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.