From f1ee9718586d536a22bb17c1bc29f4df0054d605 Mon Sep 17 00:00:00 2001 From: Kevin Israel Date: Thu, 10 Mar 2016 09:45:41 -0500 Subject: [PATCH] Clean up XCFHandler::getImageSize() No change in behavior: * Moved setting of array elements into the initializer. * Replaced sprintf() with variable interpolation. * Removed a pointless assertion. Change-Id: Ie77d26c80d592911b33bc544f831c4d34cc47d0e --- includes/media/XCF.php | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/includes/media/XCF.php b/includes/media/XCF.php index f8fa2521d3..526b45ef6a 100644 --- a/includes/media/XCF.php +++ b/includes/media/XCF.php @@ -68,21 +68,15 @@ class XCFHandler extends BitmapHandler { # Forge a return array containing metadata information just like getimagesize() # See PHP documentation at: http://www.php.net/getimagesize - $metadata = []; - $metadata[0] = $header['width']; - $metadata[1] = $header['height']; - $metadata[2] = null; # IMAGETYPE constant, none exist for XCF. - $metadata[3] = sprintf( - 'height="%s" width="%s"', $header['height'], $header['width'] - ); - $metadata['mime'] = 'image/x-xcf'; - $metadata['channels'] = null; - $metadata['bits'] = 8; # Always 8-bits per color - - assert( '7 == count($metadata); ' . - '# return array must contains 7 elements just like getimagesize() return' ); - - return $metadata; + return [ + 0 => $header['width'], + 1 => $header['height'], + 2 => null, # IMAGETYPE constant, none exist for XCF. + 3 => "height=\"{$header['height']}\" width=\"{$header['width']}\"", + 'mime' => 'image/x-xcf', + 'channels' => null, + 'bits' => 8, # Always 8-bits per color + ]; } /** -- 2.20.1