5
5
*/
6
6
namespace Magento \Framework \Image \Adapter ;
7
7
8
+ /**
9
+ * @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
10
+ */
8
11
class Gd2 extends \Magento \Framework \Image \Adapter \AbstractAdapter
9
12
{
10
13
/**
@@ -796,6 +799,9 @@ protected function _createEmptyImage($width, $height)
796
799
* @param int $alphaPercentage
797
800
*
798
801
* @return bool
802
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
803
+ * @SuppressWarnings(PHPMD.NPathComplexity)
804
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
799
805
*/
800
806
private function copyImageWithAlphaPercentage (
801
807
$ destinationImage ,
@@ -809,11 +815,30 @@ private function copyImageWithAlphaPercentage(
809
815
$ alphaPercentage
810
816
) {
811
817
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
+ );
813
829
}
814
830
815
831
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
+ );
817
842
}
818
843
819
844
if ($ alphaPercentage < 0 ) {
@@ -844,7 +869,16 @@ private function copyImageWithAlphaPercentage(
844
869
return false ;
845
870
}
846
871
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
+ );
848
882
imagedestroy ($ tmpImg );
849
883
850
884
return $ result ;
0 commit comments