Fixing PHP warnings in qrcode.php

Signed-off-by: rdwebdesign <github@rdwebdesign.com.br>
This commit is contained in:
rdwebdesign
2021-12-27 23:42:56 -03:00
parent 88039aea1c
commit 4c8f869e7b
2 changed files with 17 additions and 11 deletions

View File

@@ -64,24 +64,27 @@ class QRCode {
}
switch($mode) {
case QR_MODE_NUMBER :
$this->addDataImpl(new QRNumber($data) );
case QR_MODE_NUMBER:
$d = new QRNumber($data);
$this->addDataImpl($d);
break;
case QR_MODE_ALPHA_NUM :
$this->addDataImpl(new QRAlphaNum($data) );
case QR_MODE_ALPHA_NUM:
$d = new QRAlphaNum($data);
$this->addDataImpl($d);
break;
case QR_MODE_8BIT_BYTE :
$this->addDataImpl(new QR8BitByte($data) );
case QR_MODE_8BIT_BYTE:
$d = new QR8BitByte($data);
$this->addDataImpl($d);
break;
case QR_MODE_KANJI :
$this->addDataImpl(new QRKanji($data) );
case QR_MODE_KANJI:
$d = new QRKanji($data);
$this->addDataImpl($d);
break;
default :
default:
trigger_error("mode:$mode", E_USER_ERROR);
}
}
@@ -554,6 +557,7 @@ class QRCode {
public function printSVG($size = 2)
{
$size = (int) $size;
$width = $this->getModuleCount() * $size;
$height = $width;
print('<svg width="' . $width . '" height="' . $height . '" viewBox="0 0 ' . $width . ' ' . $height . '" xmlns="http://www.w3.org/2000/svg">');