Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 11 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| TransformTooBigImageAreaError | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
2 | |||
| getHttpStatusCode | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Base class for the output of file transformation methods. |
| 4 | * |
| 5 | * @license GPL-2.0-or-later |
| 6 | * @file |
| 7 | * @ingroup Media |
| 8 | */ |
| 9 | |
| 10 | namespace MediaWiki\Media; |
| 11 | |
| 12 | /** |
| 13 | * Shortcut class for parameter file size errors |
| 14 | * |
| 15 | * @newable |
| 16 | * @ingroup Media |
| 17 | * @since 1.25 |
| 18 | */ |
| 19 | class TransformTooBigImageAreaError extends MediaTransformError { |
| 20 | |
| 21 | /** |
| 22 | * @stable to call |
| 23 | * |
| 24 | * @param array $params |
| 25 | * @param int $maxImageArea |
| 26 | */ |
| 27 | public function __construct( $params, $maxImageArea ) { |
| 28 | $msg = wfMessage( 'thumbnail_toobigimagearea' ); |
| 29 | $msg->params( |
| 30 | // messages used: size-pixel, size-kilopixel, size-megapixel, size-gigapixel, size-terapixel, |
| 31 | // size-petapixel, size-exapixel, size-zettapixel, size-yottapixel, size-ronnapixel, size-quettapixel |
| 32 | $msg->getLanguage()->formatComputingNumbers( $maxImageArea, 1000, "size-$1pixel" ) |
| 33 | ); |
| 34 | |
| 35 | parent::__construct( 'thumbnail_error', |
| 36 | max( $params['width'] ?? 0, 120 ), |
| 37 | max( $params['height'] ?? 0, 120 ), |
| 38 | $msg |
| 39 | ); |
| 40 | } |
| 41 | |
| 42 | /** @inheritDoc */ |
| 43 | public function getHttpStatusCode() { |
| 44 | return 400; |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | /** @deprecated class alias since 1.46 */ |
| 49 | class_alias( TransformTooBigImageAreaError::class, 'TransformTooBigImageAreaError' ); |