This commit is contained in:
codemasher
2021-01-16 20:01:29 +01:00
parent 37d4b9faad
commit b11f4ef61e
3 changed files with 21 additions and 19 deletions
+3 -3
View File
@@ -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
View File
@@ -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
+1 -1
View File
@@ -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
*/