mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-30 03:58:28 +00:00
🚿
This commit is contained in:
@@ -85,17 +85,17 @@ final class ReedSolomonEncoder{
|
||||
|
||||
$rsPolyDegree = $rsPoly->getDegree();
|
||||
|
||||
$num = (new GenericGFPoly($dataBytes, $rsPolyDegree))
|
||||
$modCoefficients = (new GenericGFPoly($dataBytes, $rsPolyDegree))
|
||||
->mod($rsPoly)
|
||||
->getCoefficients()
|
||||
;
|
||||
|
||||
$ecBytes = array_fill(0, $rsPolyDegree, 0);
|
||||
$count = count($num) - count($ecBytes);
|
||||
$count = count($modCoefficients) - $rsPolyDegree;
|
||||
|
||||
foreach($ecBytes as $i => &$val){
|
||||
$modIndex = $i + $count;
|
||||
$val = $modIndex >= 0 ? $num[$modIndex] : 0;
|
||||
$val = $modIndex >= 0 ? $modCoefficients[$modIndex] : 0;
|
||||
}
|
||||
|
||||
return $ecBytes;
|
||||
|
||||
+17
-15
@@ -23,6 +23,23 @@ use function range, sprintf;
|
||||
*/
|
||||
class QRData{
|
||||
|
||||
/**
|
||||
* the options instance
|
||||
*
|
||||
* @var \chillerlan\Settings\SettingsContainerInterface|\chillerlan\QRCode\QROptions
|
||||
*/
|
||||
protected SettingsContainerInterface $options;
|
||||
|
||||
/**
|
||||
* a BitBuffer instance
|
||||
*/
|
||||
protected BitBuffer $bitBuffer;
|
||||
|
||||
/**
|
||||
* an EccLevel instance
|
||||
*/
|
||||
protected EccLevel $eccLevel;
|
||||
|
||||
/**
|
||||
* current QR Code version
|
||||
*/
|
||||
@@ -40,20 +57,6 @@ class QRData{
|
||||
*/
|
||||
protected array $maxBitsForEcc;
|
||||
|
||||
/**
|
||||
* the options instance
|
||||
*
|
||||
* @var \chillerlan\Settings\SettingsContainerInterface|\chillerlan\QRCode\QROptions
|
||||
*/
|
||||
protected SettingsContainerInterface $options;
|
||||
|
||||
/**
|
||||
* a BitBuffer instance
|
||||
*/
|
||||
protected BitBuffer $bitBuffer;
|
||||
|
||||
protected EccLevel $eccLevel;
|
||||
|
||||
/**
|
||||
* QRData constructor.
|
||||
*
|
||||
@@ -154,7 +157,6 @@ class QRData{
|
||||
if($total <= $this->maxBitsForEcc[$version]){
|
||||
return $version;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// it's almost impossible to run into this one as $this::estimateTotalBitLength() would throw first
|
||||
|
||||
@@ -495,7 +495,7 @@ final class QRMatrix{
|
||||
* @see \chillerlan\QRCode\Data\QRData::maskECC()
|
||||
*
|
||||
* @param \SplFixedArray<int> $data
|
||||
* @param int $maskPattern
|
||||
* @param int $maskPattern
|
||||
*
|
||||
* @return \chillerlan\QRCode\Data\QRMatrix
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user