* @param string|array $descriptor Path to image file, or array structure containing paths
* @param string $basePath Directory to which paths in descriptor refer
* @param array $variants
- * @throws MWException
+ * @throws InvalidArgumentException
*/
public function __construct( $name, $module, $descriptor, $basePath, $variants ) {
$this->name = $name;
} );
$extensions = array_unique( $extensions );
if ( count( $extensions ) !== 1 ) {
- throw new MWException( 'Image type for various images differs.' );
+ throw new InvalidArgumentException( "File type for different image files of '$name' not the same." );
}
$ext = $extensions[0];
if ( !isset( self::$fileTypes[$ext] ) ) {
- throw new MWException( 'Invalid image type; svg, png, gif or jpg required.' );
+ throw new InvalidArgumentException( "Invalid file type for image files of '$name' (valid: svg, png, gif, jpg)." );
}
$this->extension = $ext;
}
}
$handler = new SvgHandler;
- $res = $handler->rasterize( $tempFilenameSvg, $tempFilenamePng, $metadata['width'], $metadata['height'] );
+ $res = $handler->rasterize(
+ $tempFilenameSvg,
+ $tempFilenamePng,
+ $metadata['width'],
+ $metadata['height']
+ );
unlink( $tempFilenameSvg );
$png = null;