|
@@ -29,6 +29,7 @@ final class Decoder{
|
|
|
private ?EccLevel $eccLevel = null;
|
|
private ?EccLevel $eccLevel = null;
|
|
|
private ?MaskPattern $maskPattern = null;
|
|
private ?MaskPattern $maskPattern = null;
|
|
|
private BitBuffer $bitBuffer;
|
|
private BitBuffer $bitBuffer;
|
|
|
|
|
+ private Detector $detector;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Decodes a QR Code represented as a BitMatrix.
|
|
* Decodes a QR Code represented as a BitMatrix.
|
|
@@ -37,7 +38,8 @@ final class Decoder{
|
|
|
* @throws \Throwable|\chillerlan\QRCode\Decoder\QRCodeDecoderException
|
|
* @throws \Throwable|\chillerlan\QRCode\Decoder\QRCodeDecoderException
|
|
|
*/
|
|
*/
|
|
|
public function decode(LuminanceSourceInterface $source):DecoderResult{
|
|
public function decode(LuminanceSourceInterface $source):DecoderResult{
|
|
|
- $matrix = (new Detector($source))->detect();
|
|
|
|
|
|
|
+ $this->detector = new Detector($source);
|
|
|
|
|
+ $matrix = $this->detector->detect();
|
|
|
|
|
|
|
|
try{
|
|
try{
|
|
|
// clone the BitMatrix to avoid errors in case we run into mirroring
|
|
// clone the BitMatrix to avoid errors in case we run into mirroring
|
|
@@ -148,6 +150,7 @@ final class Decoder{
|
|
|
'data' => $result,
|
|
'data' => $result,
|
|
|
'version' => $this->version,
|
|
'version' => $this->version,
|
|
|
'eccLevel' => $this->eccLevel,
|
|
'eccLevel' => $this->eccLevel,
|
|
|
|
|
+ 'finderPatterns' => $this->detector->getFinderPatterns(),
|
|
|
'maskPattern' => $this->maskPattern,
|
|
'maskPattern' => $this->maskPattern,
|
|
|
'structuredAppendParity' => $parityData,
|
|
'structuredAppendParity' => $parityData,
|
|
|
'structuredAppendSequence' => $symbolSequence,
|
|
'structuredAppendSequence' => $symbolSequence,
|