55 */
66namespace Magento \Framework \Image \Adapter ;
77
8+ /**
9+ * @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
10+ */
811class 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 ;
0 commit comments