diff --git a/examples/custom_output.php b/examples/custom_output.php index 1d360490f..1f95ae8dc 100644 --- a/examples/custom_output.php +++ b/examples/custom_output.php @@ -81,7 +81,7 @@ $options = new QROptions([ $qrcode = new QRCode($options); $qrcode->addByteSegment($data); -$qrOutputInterface = new MyCustomOutput($options, $qrcode->getMatrix()); +$qrOutputInterface = new MyCustomOutput($options, $qrcode->getQRMatrix()); var_dump($qrOutputInterface->dump()); diff --git a/examples/imageWithLogo.php b/examples/imageWithLogo.php index fc7b49ff9..67428ff86 100644 --- a/examples/imageWithLogo.php +++ b/examples/imageWithLogo.php @@ -93,7 +93,7 @@ $qrcode->addByteSegment('https://github.com'); header('Content-type: image/png'); -$qrOutputInterface = new QRImageWithLogo($options, $qrcode->getMatrix()); +$qrOutputInterface = new QRImageWithLogo($options, $qrcode->getQRMatrix()); // dump the output, with an additional logo // the logo could also be supplied via the options, see the svgWithLogo example diff --git a/examples/imageWithText.php b/examples/imageWithText.php index 1ea38c134..f586b6a9e 100644 --- a/examples/imageWithText.php +++ b/examples/imageWithText.php @@ -105,7 +105,7 @@ $qrcode->addByteSegment('https://www.youtube.com/watch?v=dQw4w9WgXcQ'); header('Content-type: image/png'); -$qrOutputInterface = new QRImageWithText($options, $qrcode->getMatrix()); +$qrOutputInterface = new QRImageWithText($options, $qrcode->getQRMatrix()); // dump the output, with additional text // the text could also be supplied via the options, see the svgWithLogo example diff --git a/src/Decoder/DecoderResult.php b/src/Decoder/DecoderResult.php index bb628c4d8..732c427c5 100644 --- a/src/Decoder/DecoderResult.php +++ b/src/Decoder/DecoderResult.php @@ -87,7 +87,7 @@ final class DecoderResult{ /** * Returns a QRMatrix instance with thesettings and data of the reader result */ - public function getMatrix():QRMatrix{ + public function getQRMatrix():QRMatrix{ return (new QRMatrix($this->version, $this->eccLevel, $this->maskPattern)) ->initFunctionalPatterns() ->writeCodewords($this->rawBytes) diff --git a/src/QRCode.php b/src/QRCode.php index 7b7794119..7d7cab339 100755 --- a/src/QRCode.php +++ b/src/QRCode.php @@ -216,7 +216,7 @@ class QRCode{ } } - return $this->renderMatrix($this->getMatrix(), $file); + return $this->renderMatrix($this->getQRMatrix(), $file); } /** @@ -233,7 +233,7 @@ class QRCode{ * * @throws \chillerlan\QRCode\Data\QRCodeDataException */ - public function getMatrix():QRMatrix{ + public function getQRMatrix():QRMatrix{ $dataInterface = new QRData($this->options, $this->dataSegments); $maskPattern = $this->options->maskPattern === MaskPattern::AUTO ? MaskPattern::getBestPattern($dataInterface) @@ -267,6 +267,15 @@ class QRCode{ return $matrix; } + /** + * @deprecated 5.0.0 use QRCode::getQRMatrix() instead + * @see \chillerlan\QRCode\QRCode::getQRMatrix() + * @codeCoverageIgnore + */ + public function getMatrix():QRMatrix{ + return $this->getQRMatrix(); + } + /** * initializes a fresh built-in or custom QROutputInterface * diff --git a/tests/Data/QRMatrixTest.php b/tests/Data/QRMatrixTest.php index 598b733aa..b3b75184a 100755 --- a/tests/Data/QRMatrixTest.php +++ b/tests/Data/QRMatrixTest.php @@ -141,7 +141,7 @@ final class QRMatrixTest extends TestCase{ */ public function testMaskPattern():void{ // set via matrix evaluation - $matrix = (new QRCode)->addByteSegment('testdata')->getMatrix(); + $matrix = (new QRCode)->addByteSegment('testdata')->getQRMatrix(); $this::assertInstanceOf(MaskPattern::class, $matrix->getMaskPattern()); $this::assertSame(MaskPattern::PATTERN_100, $matrix->getMaskPattern()->getPattern()); @@ -378,7 +378,7 @@ final class QRMatrixTest extends TestCase{ $o->addLogoSpace = true; $o->logoSpaceHeight = 5; - $matrix = (new QRCode($o))->addByteSegment('testdata')->getMatrix(); + $matrix = (new QRCode($o))->addByteSegment('testdata')->getQRMatrix(); self::debugMatrix($matrix); @@ -398,7 +398,7 @@ final class QRMatrixTest extends TestCase{ $o->eccLevel = EccLevel::H; $o->addQuietzone = false; - $matrix = (new QRCode($o))->addByteSegment('testdata')->getMatrix(); + $matrix = (new QRCode($o))->addByteSegment('testdata')->getQRMatrix(); // also testing size adjustment to uneven numbers $matrix->setLogoSpace(20, 14); @@ -423,7 +423,7 @@ final class QRMatrixTest extends TestCase{ $o->addQuietzone = true; $o->quietzoneSize = 10; - $matrix = (new QRCode($o))->addByteSegment('testdata')->getMatrix(); + $matrix = (new QRCode($o))->addByteSegment('testdata')->getQRMatrix(); self::debugMatrix($matrix); @@ -453,7 +453,7 @@ final class QRMatrixTest extends TestCase{ $this->expectException(QRCodeDataException::class); $this->expectExceptionMessage('ECC level "H" required to add logo space'); - (new QRCode)->addByteSegment('testdata')->getMatrix()->setLogoSpace(50, 50); + (new QRCode)->addByteSegment('testdata')->getQRMatrix()->setLogoSpace(50, 50); } /** @@ -467,7 +467,7 @@ final class QRMatrixTest extends TestCase{ $o->version = 5; $o->eccLevel = EccLevel::H; - (new QRCode($o))->addByteSegment('testdata')->getMatrix()->setLogoSpace(69, 1); + (new QRCode($o))->addByteSegment('testdata')->getQRMatrix()->setLogoSpace(69, 1); } /** @@ -481,7 +481,7 @@ final class QRMatrixTest extends TestCase{ $o->version = 5; $o->eccLevel = EccLevel::H; - (new QRCode($o))->addByteSegment('testdata')->getMatrix()->setLogoSpace(37, 37); + (new QRCode($o))->addByteSegment('testdata')->getQRMatrix()->setLogoSpace(37, 37); } /** diff --git a/tests/QRCodeReaderTestAbstract.php b/tests/QRCodeReaderTestAbstract.php index eed2f01c4..152e3dee0 100644 --- a/tests/QRCodeReaderTestAbstract.php +++ b/tests/QRCodeReaderTestAbstract.php @@ -85,7 +85,7 @@ abstract class QRCodeReaderTestAbstract extends TestCase{ /** @noinspection PhpUndefinedMethodInspection */ $result = (new QRCode)->readFromSource($this->FQN::fromFile(__DIR__.'/samples/'.$img, $this->options)); - QRMatrixTest::debugMatrix($result->getMatrix()); + QRMatrixTest::debugMatrix($result->getQRMatrix()); $this::assertSame($expected, (string)$result); }