Skip to content

Commit 503204c

Browse files
committed
Fix issues with static tests
1 parent 00a5c3a commit 503204c

File tree

2 files changed

+51
-5
lines changed

2 files changed

+51
-5
lines changed

lib/internal/Magento/Framework/Image/Adapter/Gd2.php

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\Framework\Image\Adapter;
77

8+
/**
9+
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
10+
*/
811
class Gd2 extends \Magento\Framework\Image\Adapter\AbstractAdapter
912
{
1013
/**
@@ -796,6 +799,9 @@ protected function _createEmptyImage($width, $height)
796799
* @param int $alphaPercentage
797800
*
798801
* @return bool
802+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
803+
* @SuppressWarnings(PHPMD.NPathComplexity)
804+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
799805
*/
800806
private function copyImageWithAlphaPercentage(
801807
$destinationImage,
@@ -809,11 +815,30 @@ private function copyImageWithAlphaPercentage(
809815
$alphaPercentage
810816
) {
811817
if (imageistruecolor($destinationImage) === false || imageistruecolor($sourceImage) === false) {
812-
return imagecopymerge($destinationImage, $sourceImage, $destinationX, $destinationY, $sourceX, $sourceY, $sourceWidth, $sourceHeight, $alphaPercentage);
818+
return imagecopymerge(
819+
$destinationImage,
820+
$sourceImage,
821+
$destinationX,
822+
$destinationY,
823+
$sourceX,
824+
$sourceY,
825+
$sourceWidth,
826+
$sourceHeight,
827+
$alphaPercentage
828+
);
813829
}
814830

815831
if ($alphaPercentage >= 100) {
816-
return imagecopy($destinationImage, $sourceImage, $destinationX, $destinationY, $sourceX, $sourceY, $sourceWidth, $sourceHeight);
832+
return imagecopy(
833+
$destinationImage,
834+
$sourceImage,
835+
$destinationX,
836+
$destinationY,
837+
$sourceX,
838+
$sourceY,
839+
$sourceWidth,
840+
$sourceHeight
841+
);
817842
}
818843

819844
if ($alphaPercentage < 0) {
@@ -844,7 +869,16 @@ private function copyImageWithAlphaPercentage(
844869
return false;
845870
}
846871

847-
$result = imagecopy($destinationImage, $tmpImg, $destinationX, $destinationY, $sourceX, $sourceY, $sourceWidth, $sourceHeight);
872+
$result = imagecopy(
873+
$destinationImage,
874+
$tmpImg,
875+
$destinationX,
876+
$destinationY,
877+
$sourceX,
878+
$sourceY,
879+
$sourceWidth,
880+
$sourceHeight
881+
);
848882
imagedestroy($tmpImg);
849883

850884
return $result;

lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,14 +311,26 @@ public function watermark($imagePath, $positionX = 0, $positionY = 0, $opacity =
311311
$offsetY = $positionY;
312312
while ($offsetY <= $this->_imageSrcHeight + $watermark->getImageHeight()) {
313313
while ($offsetX <= $this->_imageSrcWidth + $watermark->getImageWidth()) {
314-
$this->_imageHandler->compositeImage($watermark, \Imagick::COMPOSITE_OVER, $offsetX, $offsetY, $compositeChannels);
314+
$this->_imageHandler->compositeImage(
315+
$watermark,
316+
\Imagick::COMPOSITE_OVER,
317+
$offsetX,
318+
$offsetY,
319+
$compositeChannels
320+
);
315321
$offsetX += $watermark->getImageWidth();
316322
}
317323
$offsetX = $positionX;
318324
$offsetY += $watermark->getImageHeight();
319325
}
320326
} else {
321-
$this->_imageHandler->compositeImage($watermark, \Imagick::COMPOSITE_OVER, $positionX, $positionY, $compositeChannels);
327+
$this->_imageHandler->compositeImage(
328+
$watermark,
329+
\Imagick::COMPOSITE_OVER,
330+
$positionX,
331+
$positionY,
332+
$compositeChannels
333+
);
322334
}
323335
} catch (\ImagickException $e) {
324336
throw new \Exception('Unable to create watermark.', $e->getCode(), $e);

0 commit comments

Comments
 (0)