mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-09-15 12:16:25 +00:00
added @property mode
This commit is contained in:
@@ -17,6 +17,7 @@ use chillerlan\QRCode\BitBuffer;
|
||||
/**
|
||||
* @property string data
|
||||
* @property int dataLength
|
||||
* @property int mode
|
||||
*/
|
||||
interface QRDataInterface{
|
||||
|
||||
|
||||
+5
-5
@@ -16,7 +16,6 @@ use chillerlan\QRCode\Data\AlphaNum;
|
||||
use chillerlan\QRCode\Data\Byte;
|
||||
use chillerlan\QRCode\Data\Kanji;
|
||||
use chillerlan\QRCode\Data\Number;
|
||||
use chillerlan\QRCode\Data\QRDataInterface;
|
||||
use chillerlan\QRCode\Output\QROutputInterface;
|
||||
|
||||
/**
|
||||
@@ -162,10 +161,11 @@ class QRCode{
|
||||
* @throws \chillerlan\QRCode\QRCodeException
|
||||
*/
|
||||
protected function getTypeNumber($mode){
|
||||
/** @noinspection PhpUndefinedFieldInspection */
|
||||
$length = $this->qrDataInterface->mode === QRConst::MODE_KANJI
|
||||
? floor($this->qrDataInterface->dataLength / 2)
|
||||
: $this->qrDataInterface->dataLength;
|
||||
$length = $this->qrDataInterface->dataLength;
|
||||
|
||||
if($this->qrDataInterface->mode === QRConst::MODE_KANJI){
|
||||
$length = floor($this->qrDataInterface->dataLength / 2);
|
||||
}
|
||||
|
||||
foreach(range(1, 10) as $type){
|
||||
if($length <= Util::getMaxLength($type, $mode, $this->errorCorrectLevel)){
|
||||
|
||||
Reference in New Issue
Block a user