mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-09-01 13:08:14 +00:00
:octocat: rename QRCode::getMatrix() and RecoderResult::getMatrix() to getQRMatrix()
This commit is contained in:
@@ -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());
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
+11
-2
@@ -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
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user