🛀 extract Mode

This commit is contained in:
codemasher
2020-11-21 21:52:19 +01:00
parent cbf8a990ca
commit 37a40571e6
11 changed files with 124 additions and 78 deletions
+4 -4
View File
@@ -13,7 +13,7 @@
namespace chillerlan\QRCode\Data;
use chillerlan\QRCode\Helpers\BitBuffer;
use chillerlan\QRCode\QRCode;
use chillerlan\QRCode\Common\Mode;
use function ord;
@@ -25,7 +25,7 @@ use function ord;
*/
final class Byte extends QRDataModeAbstract{
protected array $lengthBits = [8, 16, 16];
protected int $datamode = Mode::DATA_BYTE;
/**
* @inheritdoc
@@ -48,8 +48,8 @@ final class Byte extends QRDataModeAbstract{
$len = $this->getCharCount();
$bitBuffer
->put(QRCode::DATA_BYTE, 4)
->put($len, $this->getLengthBitsForVersion($version))
->put($this->datamode, 4)
->put($len, Mode::getLengthBitsForVersion($this->datamode, $version))
;
$i = 0;