| Conditions | 1 |
| Paths | 1 |
| Total Lines | 11 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 1 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | 8 | private function getMessageFromUploadError(int $uploadError): string |
|
| 18 | { |
||
| 19 | 8 | return match ($uploadError) { |
|
| 20 | 8 | UPLOAD_ERR_CANT_WRITE => 'Failed to write file to disk', |
|
| 21 | 8 | UPLOAD_ERR_EXTENSION => 'A PHP extension stopped the upload', |
|
| 22 | 8 | UPLOAD_ERR_FORM_SIZE => 'The file exceeds the `MAX_FILE_SIZE` directive that was specified in the HTML form', |
|
| 23 | 8 | UPLOAD_ERR_INI_SIZE => 'The file exceeds the `upload_max_filesize` of ' . Utility::toMebibyte(Utility::getUploadMaxFilesize()), |
|
| 24 | 8 | UPLOAD_ERR_NO_FILE => 'No file was uploaded', |
|
| 25 | 8 | UPLOAD_ERR_NO_TMP_DIR => 'Missing a temporary folder', |
|
| 26 | 8 | UPLOAD_ERR_PARTIAL => 'The file was only partially uploaded', |
|
| 27 | 8 | default => throw new Exception('Unsupported UPLOAD_ERR_* constant value: ' . $uploadError), |
|
| 28 | 8 | }; |
|
| 31 |