Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| FileUploadException | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | namespace Apie\Serializer\Exceptions; |
| 3 | |
| 4 | use Apie\Core\Exceptions\ApieException; |
| 5 | use Psr\Http\Message\UploadedFileInterface; |
| 6 | |
| 7 | final class FileUploadException extends ApieException |
| 8 | { |
| 9 | private const ERRORS = [ |
| 10 | UPLOAD_ERR_OK => 'File upload error: no error?', |
| 11 | UPLOAD_ERR_INI_SIZE => 'File too large', |
| 12 | UPLOAD_ERR_FORM_SIZE => 'File too large', |
| 13 | UPLOAD_ERR_PARTIAL => 'File upload is incomplete', |
| 14 | UPLOAD_ERR_NO_FILE => 'No file upload found', |
| 15 | UPLOAD_ERR_NO_TMP_DIR => 'Internal server file handling 6', |
| 16 | UPLOAD_ERR_CANT_WRITE => 'Internal server file handling 7', |
| 17 | UPLOAD_ERR_EXTENSION => 'Internal server file handling 8', |
| 18 | ]; |
| 19 | |
| 20 | public function __construct(UploadedFileInterface $file) |
| 21 | { |
| 22 | parent::__construct(self::ERRORS[$file->getError()] ?? 'Unknown file upload error'); |
| 23 | } |
| 24 | } |