|
10 | 10 | use Base32\Base32;
|
11 | 11 | use Endroid\QrCode\Color\Color;
|
12 | 12 | use Endroid\QrCode\Encoding\Encoding;
|
| 13 | +use Endroid\QrCode\ErrorCorrectionLevel; |
13 | 14 | use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelHigh;
|
14 | 15 | use Endroid\QrCode\QrCode;
|
| 16 | +use Endroid\QrCode\RoundBlockSizeMode; |
15 | 17 | use Endroid\QrCode\Writer\PngWriter;
|
16 | 18 | use Exception;
|
17 | 19 | use Magento\Framework\App\Config\ScopeConfigInterface;
|
@@ -214,13 +216,17 @@ public function verify(UserInterface $user, DataObject $request): bool
|
214 | 216 | public function getQrCodeAsPng(UserInterface $user): string
|
215 | 217 | {
|
216 | 218 | // @codingStandardsIgnoreStart
|
217 |
| - $qrCode = new QrCode($this->getProvisioningUrl($user)); |
218 |
| - $qrCode->setSize(400); |
219 |
| - $qrCode->setMargin(0); |
220 |
| - $qrCode->setErrorCorrectionLevel(new ErrorCorrectionLevelHigh()); |
221 |
| - $qrCode->setForegroundColor(new Color(0, 0, 0, 0)); |
222 |
| - $qrCode->setBackgroundColor(new Color(255, 255, 255, 0)); |
223 |
| - $qrCode->setEncoding(new Encoding('UTF-8')); |
| 219 | + $qrCode = new QrCode( |
| 220 | + $this->getProvisioningUrl($user), |
| 221 | + new Encoding('UTF-8'), |
| 222 | + ErrorCorrectionLevel::High, |
| 223 | + 400, |
| 224 | + 0, |
| 225 | + RoundBlockSizeMode::Margin, |
| 226 | + new Color(0, 0, 0, 0), |
| 227 | + new Color(255, 255, 255, 0) |
| 228 | + ); |
| 229 | + |
224 | 230 |
|
225 | 231 | $writer = new PngWriter();
|
226 | 232 | $pngData = $writer->write($qrCode);
|
|
0 commit comments