@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * Get metadata, unserializing it if neccessary. |
256 | 256 | * |
257 | 257 | * @param File $file The DjVu file in question |
258 | - * @return string XML metadata as a string. |
|
258 | + * @return boolean XML metadata as a string. |
|
259 | 259 | * @throws MWException |
260 | 260 | */ |
261 | 261 | private function getUnserializedMetadata( File $file ) { |
@@ -371,6 +371,10 @@ discard block |
||
371 | 371 | return 'djvuxml'; |
372 | 372 | } |
373 | 373 | |
374 | + /** |
|
375 | + * @param File $image |
|
376 | + * @param boolean $metadata |
|
377 | + */ |
|
374 | 378 | function isMetadataValid( $image, $metadata ) { |
375 | 379 | return !empty( $metadata ) && $metadata != serialize( array() ); |
376 | 380 | } |
@@ -94,6 +94,11 @@ discard block |
||
94 | 94 | fclose( $file ); |
95 | 95 | } |
96 | 96 | |
97 | + /** |
|
98 | + * @param resource $file |
|
99 | + * @param string $length |
|
100 | + * @param integer $indent |
|
101 | + */ |
|
97 | 102 | private function dumpForm( $file, $length, $indent ) { |
98 | 103 | $start = ftell( $file ); |
99 | 104 | $secondary = fread( $file, 4 ); |
@@ -187,6 +192,10 @@ discard block |
||
187 | 192 | } |
188 | 193 | } |
189 | 194 | |
195 | + /** |
|
196 | + * @param resource $file |
|
197 | + * @param string $formLength |
|
198 | + */ |
|
190 | 199 | private function getMultiPageInfo( $file, $formLength ) { |
191 | 200 | // For now, we'll just look for the first page in the file |
192 | 201 | // and report its information, hoping others are the same size. |
@@ -390,6 +399,9 @@ discard block |
||
390 | 399 | return $xml; |
391 | 400 | } |
392 | 401 | |
402 | + /** |
|
403 | + * @param string $line |
|
404 | + */ |
|
393 | 405 | function parseFormDjvu( $line, &$xml ) { |
394 | 406 | $parentLevel = strspn( $line, ' ' ); |
395 | 407 | $line = strtok( "\n" ); |
@@ -82,7 +82,7 @@ |
||
82 | 82 | |
83 | 83 | /** |
84 | 84 | * @param File $image |
85 | - * @param array $metadata |
|
85 | + * @param boolean $metadata |
|
86 | 86 | * @return bool|int |
87 | 87 | */ |
88 | 88 | function isMetadataValid( $image, $metadata ) { |
@@ -1230,8 +1230,8 @@ discard block |
||
1230 | 1230 | * numbers, joins arrays of numbers with commas. |
1231 | 1231 | * |
1232 | 1232 | * @param mixed $num The value to format |
1233 | - * @param float|int|bool $round Digits to round to or false. |
|
1234 | - * @return mixed A floating point number or whatever we were fed |
|
1233 | + * @param integer $round Digits to round to or false. |
|
1234 | + * @return string|null A floating point number or whatever we were fed |
|
1235 | 1235 | */ |
1236 | 1236 | private function formatNum( $num, $round = false ) { |
1237 | 1237 | $m = array(); |
@@ -1396,7 +1396,7 @@ discard block |
||
1396 | 1396 | * |
1397 | 1397 | * @param int $coord Degrees, minutes and seconds |
1398 | 1398 | * @param string $type Latitude or longitude (for if its a NWS or E) |
1399 | - * @return mixed A floating point number or whatever we were fed |
|
1399 | + * @return string A floating point number or whatever we were fed |
|
1400 | 1400 | */ |
1401 | 1401 | private function formatCoords( $coord, $type ) { |
1402 | 1402 | $ref = ''; |
@@ -44,7 +44,7 @@ |
||
44 | 44 | * and those can't extract xmp on files containing both exif and xmp data |
45 | 45 | * |
46 | 46 | * @param string $filename Name of jpeg file |
47 | - * @return array Array of interesting segments. |
|
47 | + * @return string Array of interesting segments. |
|
48 | 48 | * @throws MWException If given invalid file. |
49 | 49 | */ |
50 | 50 | static function segmentSplitter( $filename ) { |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @note This method is currently unused. |
198 | 198 | * @param File $image |
199 | - * @return string |
|
199 | + * @return boolean |
|
200 | 200 | */ |
201 | 201 | function getMetadataType( $image ) { |
202 | 202 | return false; |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * this interface, it should return an empty array, not false. |
252 | 252 | * |
253 | 253 | * @param File $file |
254 | - * @return array|bool False if interface not supported |
|
254 | + * @return boolean False if interface not supported |
|
255 | 255 | * @since 1.23 |
256 | 256 | */ |
257 | 257 | public function getCommonMetaArray( File $file ) { |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * @param File $image |
269 | 269 | * @param string $script |
270 | 270 | * @param array $params |
271 | - * @return bool|ThumbnailImage |
|
271 | + * @return boolean |
|
272 | 272 | */ |
273 | 273 | function getScriptedTransform( $image, $script, $params ) { |
274 | 274 | return false; |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | * @param string $ext Extension of original file |
309 | 309 | * @param string $mime MIME type of original file |
310 | 310 | * @param array $params Handler specific rendering parameters |
311 | - * @return array Thumbnail extension and MIME type |
|
311 | + * @return string[] Thumbnail extension and MIME type |
|
312 | 312 | */ |
313 | 313 | function getThumbType( $ext, $mime, $params = null ) { |
314 | 314 | $magic = MimeMagic::singleton(); |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | * Currently overloaded by PDF and DjVu handlers |
452 | 452 | * @param File $image |
453 | 453 | * @param int $page Page number to get information for |
454 | - * @return bool|string Page text or false when no text found or if |
|
454 | + * @return boolean Page text or false when no text found or if |
|
455 | 455 | * unsupported. |
456 | 456 | */ |
457 | 457 | function getPageText( File $image, $page ) { |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | * indication of grouped and chained streams in ogg container files. |
509 | 509 | * @param File $image |
510 | 510 | * @param bool|IContextSource $context Context to use (optional) |
511 | - * @return array|bool |
|
511 | + * @return boolean |
|
512 | 512 | */ |
513 | 513 | function formatMetadata( $image, $context = false ) { |
514 | 514 | return false; |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | * @param int $boxWidth Width of the thumbnail box. |
649 | 649 | * @param int $boxHeight Height of the thumbnail box. |
650 | 650 | * @param int $maxHeight Maximum height expected for the thumbnail. |
651 | - * @return int |
|
651 | + * @return double |
|
652 | 652 | */ |
653 | 653 | public static function fitBoxWidth( $boxWidth, $boxHeight, $maxHeight ) { |
654 | 654 | $idealWidth = $boxWidth * $maxHeight / $boxHeight; |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | /** |
81 | 81 | * Get the final extension of the thumbnail. |
82 | 82 | * Returns false for scripted transformations. |
83 | - * @return string|bool |
|
83 | + * @return string|false |
|
84 | 84 | */ |
85 | 85 | public function getExtension() { |
86 | 86 | return $this->path ? FileBackend::extensionFromPath( $this->path ) : false; |
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | - * @return string|bool The thumbnail URL |
|
90 | + * @return string The thumbnail URL |
|
91 | 91 | */ |
92 | 92 | public function getUrl() { |
93 | 93 | return $this->url; |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * |
215 | 215 | * @deprecated since 1.26, use streamFileWithStatus |
216 | 216 | * @param array $headers Additional HTTP headers to send on success |
217 | - * @return bool Success |
|
217 | + * @return boolean|null Success |
|
218 | 218 | */ |
219 | 219 | public function streamFile( $headers = array() ) { |
220 | 220 | $this->streamFileWithStatus( $headers )->isOK(); |
@@ -443,6 +443,9 @@ discard block |
||
443 | 443 | /** @var string Plain text formatted version of the error */ |
444 | 444 | private $textMsg; |
445 | 445 | |
446 | + /** |
|
447 | + * @param string $msg |
|
448 | + */ |
|
446 | 449 | function __construct( $msg, $width, $height /*, ... */ ) { |
447 | 450 | $args = array_slice( func_get_args(), 3 ); |
448 | 451 | $htmlArgs = array_map( 'htmlspecialchars', $args ); |
@@ -29,6 +29,10 @@ discard block |
||
29 | 29 | * @ingroup Media |
30 | 30 | */ |
31 | 31 | class SVGMetadataExtractor { |
32 | + |
|
33 | + /** |
|
34 | + * @param string $filename |
|
35 | + */ |
|
32 | 36 | static function getMetadata( $filename ) { |
33 | 37 | $svg = new SVGReader( $filename ); |
34 | 38 | |
@@ -372,7 +376,7 @@ discard block |
||
372 | 376 | * http://www.w3.org/TR/SVG11/coords.html#UnitIdentifiers |
373 | 377 | * |
374 | 378 | * @param string $length CSS/SVG length. |
375 | - * @param float|int $viewportSize Optional scale for percentage units... |
|
379 | + * @param integer $viewportSize Optional scale for percentage units... |
|
376 | 380 | * @return float Length in pixels |
377 | 381 | */ |
378 | 382 | static function scaleSVGUnit( $length, $viewportSize = 512 ) { |
@@ -43,6 +43,9 @@ discard block |
||
43 | 43 | const VP8X_XMP = 4; |
44 | 44 | const VP8X_ANIM = 2; |
45 | 45 | |
46 | + /** |
|
47 | + * @param string $filename |
|
48 | + */ |
|
46 | 49 | public function getMetadata( $image, $filename ) { |
47 | 50 | $parsedWebPData = self::extractMetadata( $filename ); |
48 | 51 | if ( !$parsedWebPData ) { |
@@ -86,7 +89,6 @@ discard block |
||
86 | 89 | /** |
87 | 90 | * Extracts the image size and WebP type from a file |
88 | 91 | * |
89 | - * @param string $chunks Chunks as extracted by RiffExtractor |
|
90 | 92 | * @return array|bool Header data array with entries 'compression', 'width' and 'height', |
91 | 93 | * where 'compression' can be 'lossy', 'lossless', 'animated' or 'unknown'. False if |
92 | 94 | * file is not a valid WebP file. |
@@ -289,7 +291,7 @@ discard block |
||
289 | 291 | * @param $ext |
290 | 292 | * @param $mime |
291 | 293 | * @param $params |
292 | - * @return array |
|
294 | + * @return string[] |
|
293 | 295 | */ |
294 | 296 | public function getThumbType( $ext, $mime, $params = null ) { |
295 | 297 | return array( 'png', 'image/png' ); |