|
16 | 16 | use chillerlan\QRCode\Data\QRMatrix; |
17 | 17 | use chillerlan\Settings\SettingsContainerInterface; |
18 | 18 | use ErrorException, GdImage, Throwable; |
19 | | -use function array_values, count, extension_loaded, imagecolorallocate, imagecolortransparent, |
| 19 | +use function extension_loaded, imagecolorallocate, imagecolortransparent, |
20 | 20 | imagecreatetruecolor, imagedestroy, imagefilledellipse, imagefilledrectangle, |
21 | | - imagescale, imagetypes, intdiv, intval, is_array, is_numeric, max, min, ob_end_clean, ob_get_contents, ob_start, |
| 21 | + imagescale, imagetypes, intdiv, intval, max, min, ob_end_clean, ob_get_contents, ob_start, |
22 | 22 | restore_error_handler, set_error_handler, sprintf; |
23 | 23 | use const IMG_AVIF, IMG_BMP, IMG_GIF, IMG_JPG, IMG_PNG, IMG_WEBP; |
24 | 24 |
|
|
29 | 29 | * @see https://github.com/chillerlan/php-qrcode/issues/223 |
30 | 30 | */ |
31 | 31 | abstract class QRGdImage extends QROutputAbstract{ |
| 32 | + use RGBArrayModuleValueTrait; |
32 | 33 |
|
33 | 34 | /** |
34 | 35 | * The GD image resource |
@@ -105,31 +106,6 @@ protected function checkGD():void{ |
105 | 106 |
|
106 | 107 | } |
107 | 108 |
|
108 | | - /** |
109 | | - * @inheritDoc |
110 | | - */ |
111 | | - public static function moduleValueIsValid(mixed $value):bool{ |
112 | | - |
113 | | - if(!is_array($value) || count($value) < 3){ |
114 | | - return false; |
115 | | - } |
116 | | - |
117 | | - // check the first 3 values of the array |
118 | | - foreach(array_values($value) as $i => $val){ |
119 | | - |
120 | | - if($i > 2){ |
121 | | - break; |
122 | | - } |
123 | | - |
124 | | - if(!is_numeric($val)){ |
125 | | - return false; |
126 | | - } |
127 | | - |
128 | | - } |
129 | | - |
130 | | - return true; |
131 | | - } |
132 | | - |
133 | 109 | /** |
134 | 110 | * @inheritDoc |
135 | 111 | * @throws \chillerlan\QRCode\Output\QRCodeOutputException |
|
0 commit comments