| Conditions | 3 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | public function validates($value, $context = []) |
||
| 37 | { |
||
| 38 | $valid = true; |
||
| 39 | /** @var File $input */ |
||
| 40 | $input = $context['input']; |
||
| 41 | /** @var UploadedFileInterface $file */ |
||
| 42 | $file = $input->getValue(); |
||
| 43 | if ( |
||
| 44 | $file->getError() != UPLOAD_ERR_OK && |
||
| 45 | $file->getError() != UPLOAD_ERR_NO_FILE |
||
| 46 | ) { |
||
| 47 | $valid = false; |
||
| 48 | $this->addMessage( |
||
| 49 | $this->messageTemplate, |
||
| 50 | $this->uploadErrors[$file->getError()] |
||
| 51 | ); |
||
| 52 | } |
||
| 53 | return $valid; |
||
| 54 | } |
||
| 55 | } |