From 2794192eaa186eb1006947004f2c52d610a0fe3c Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sat, 28 Jan 2012 17:05:20 +0000 Subject: [PATCH] Fix unused variables Fix trailing whitespace Add/Improve documentation Explicit member variable declaration --- CreatePdfThumbnailsJob.class.php | 9 ++++++-- PdfHandler.image.php | 35 +++++++++++++++++++++++++------- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/CreatePdfThumbnailsJob.class.php b/CreatePdfThumbnailsJob.class.php index f5a6570..8b65f58 100644 --- a/CreatePdfThumbnailsJob.class.php +++ b/CreatePdfThumbnailsJob.class.php @@ -53,7 +53,7 @@ class CreatePdfThumbnailsJob extends Job { $max = $wgImageLimits[$sizeSel]; $maxWidth = $max[0]; $maxHeight = $max[1]; - + $width_orig = $file->getWidth( $this->params['page'] ); $width = $width_orig; $height_orig = $file->getHeight( $this->params['page'] ); @@ -87,7 +87,12 @@ class CreatePdfThumbnailsJob extends Job { return true; } - + /** + * @param $upload + * @param $mime + * @param $error + * @return bool + */ public static function insertJobs( $upload, $mime, &$error ) { global $wgPdfCreateThumbnailsInJobQueue; if ( !$wgPdfCreateThumbnailsInJobQueue ) { diff --git a/PdfHandler.image.php b/PdfHandler.image.php index 805a59d..1e27293 100644 --- a/PdfHandler.image.php +++ b/PdfHandler.image.php @@ -26,14 +26,23 @@ class PdfImage { + /** + * @param $filename + */ function __construct( $filename ) { $this->mFilename = $filename; } + /** + * @return bool + */ public function isValid() { return true; } + /** + * @return array|bool + */ public function getImageSize() { $data = $this->retrieveMetadata(); $size = self::getPageSize( $data, 1 ); @@ -47,6 +56,11 @@ class PdfImage { return false; } + /** + * @param $data array + * @param $page + * @return array|bool + */ public static function getPageSize( $data, $page ) { global $wgPdfHandlerDpi; @@ -57,15 +71,15 @@ class PdfImage { } else { $o = false; } - if( isset( $data['pages'][$page]['Page rot'] ) ) { - $r = $data['pages'][$page]['Page rot']; - } elseif( isset( $data['Page rot'] ) ) { - $r = $data['Page rot']; - } else { - $r = 0; - } if ( $o ) { + if( isset( $data['pages'][$page]['Page rot'] ) ) { + $r = $data['pages'][$page]['Page rot']; + } elseif( isset( $data['Page rot'] ) ) { + $r = $data['Page rot']; + } else { + $r = 0; + } $size = explode( 'x', $o, 2 ); if ( $size ) { @@ -89,6 +103,9 @@ class PdfImage { return false; } + /** + * @return array|bool|null + */ public function retrieveMetaData() { global $wgPdfInfo, $wgPdftoText; @@ -128,6 +145,10 @@ class PdfImage { return $data; } + /** + * @param $dump string + * @return array|bool + */ protected function convertDumpToArray( $dump ) { if ( strval( $dump ) == '' ) { return false;