Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
BitmapHandler_ClientOnly
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 2
12
0.00% covered (danger)
0.00%
0 / 1
 normaliseParams
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 doTransform
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2/**
3 * Handler for bitmap images that will be resized by clients.
4 *
5 * @license GPL-2.0-or-later
6 * @file
7 * @ingroup Media
8 */
9
10namespace MediaWiki\Media;
11
12use MediaWiki\FileRepo\File\File;
13
14/**
15 * Handler for bitmap images that will be resized by clients.
16 *
17 * This is not used by default but can be assigned to some image types
18 * using $wgMediaHandlers.
19 *
20 * @ingroup Media
21 */
22// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
23class BitmapHandler_ClientOnly extends BitmapHandler {
24
25    /**
26     * @param File $image
27     * @param array &$params
28     * @return bool
29     */
30    public function normaliseParams( $image, &$params ) {
31        return ImageHandler::normaliseParams( $image, $params );
32    }
33
34    /**
35     * @param File $image
36     * @param string $dstPath
37     * @param string $dstUrl
38     * @param array $params
39     * @param int $flags
40     * @return ThumbnailImage|TransformParameterError
41     */
42    public function doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 ) {
43        if ( !$this->normaliseParams( $image, $params ) ) {
44            return new TransformParameterError( $params );
45        }
46
47        return new ThumbnailImage( $image, $image->getUrl(), $image->getLocalRefPath(), $params );
48    }
49}
50
51/** @deprecated class alias since 1.46 */
52class_alias( BitmapHandler_ClientOnly::class, 'BitmapHandler_ClientOnly' );