added @property mode

This commit is contained in:
smiley
2016-02-24 00:42:53 +01:00
parent edd8e71e92
commit 3c4102d4b5
2 changed files with 6 additions and 5 deletions
+1
View File
@@ -17,6 +17,7 @@ use chillerlan\QRCode\BitBuffer;
/**
* @property string data
* @property int dataLength
* @property int mode
*/
interface QRDataInterface{
+5 -5
View File
@@ -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)){