Skip to content

Commit 9bc23a2

Browse files
committed
:octocat: rename QRCode::getMatrix() and RecoderResult::getMatrix() to getQRMatrix()
1 parent 2c389c7 commit 9bc23a2

File tree

7 files changed

+23
-14
lines changed

7 files changed

+23
-14
lines changed

examples/custom_output.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function dump(string $file = null):string{
8181
$qrcode = new QRCode($options);
8282
$qrcode->addByteSegment($data);
8383

84-
$qrOutputInterface = new MyCustomOutput($options, $qrcode->getMatrix());
84+
$qrOutputInterface = new MyCustomOutput($options, $qrcode->getQRMatrix());
8585

8686
var_dump($qrOutputInterface->dump());
8787

examples/imageWithLogo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function dump(string $file = null, string $logo = null):string{
9393

9494
header('Content-type: image/png');
9595

96-
$qrOutputInterface = new QRImageWithLogo($options, $qrcode->getMatrix());
96+
$qrOutputInterface = new QRImageWithLogo($options, $qrcode->getQRMatrix());
9797

9898
// dump the output, with an additional logo
9999
// the logo could also be supplied via the options, see the svgWithLogo example

examples/imageWithText.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ protected function addText(string $text):void{
105105

106106
header('Content-type: image/png');
107107

108-
$qrOutputInterface = new QRImageWithText($options, $qrcode->getMatrix());
108+
$qrOutputInterface = new QRImageWithText($options, $qrcode->getQRMatrix());
109109

110110
// dump the output, with additional text
111111
// the text could also be supplied via the options, see the svgWithLogo example

src/Decoder/DecoderResult.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function hasStructuredAppend():bool{
8787
/**
8888
* Returns a QRMatrix instance with thesettings and data of the reader result
8989
*/
90-
public function getMatrix():QRMatrix{
90+
public function getQRMatrix():QRMatrix{
9191
return (new QRMatrix($this->version, $this->eccLevel, $this->maskPattern))
9292
->initFunctionalPatterns()
9393
->writeCodewords($this->rawBytes)

src/QRCode.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public function render(string $data = null, string $file = null){
216216
}
217217
}
218218

219-
return $this->renderMatrix($this->getMatrix(), $file);
219+
return $this->renderMatrix($this->getQRMatrix(), $file);
220220
}
221221

222222
/**
@@ -233,7 +233,7 @@ public function renderMatrix(QRMatrix $matrix, string $file = null){
233233
*
234234
* @throws \chillerlan\QRCode\Data\QRCodeDataException
235235
*/
236-
public function getMatrix():QRMatrix{
236+
public function getQRMatrix():QRMatrix{
237237
$dataInterface = new QRData($this->options, $this->dataSegments);
238238
$maskPattern = $this->options->maskPattern === MaskPattern::AUTO
239239
? MaskPattern::getBestPattern($dataInterface)
@@ -267,6 +267,15 @@ public function getMatrix():QRMatrix{
267267
return $matrix;
268268
}
269269

270+
/**
271+
* @deprecated 5.0.0 use QRCode::getQRMatrix() instead
272+
* @see \chillerlan\QRCode\QRCode::getQRMatrix()
273+
* @codeCoverageIgnore
274+
*/
275+
public function getMatrix():QRMatrix{
276+
return $this->getQRMatrix();
277+
}
278+
270279
/**
271280
* initializes a fresh built-in or custom QROutputInterface
272281
*

tests/Data/QRMatrixTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function testECC():void{
141141
*/
142142
public function testMaskPattern():void{
143143
// set via matrix evaluation
144-
$matrix = (new QRCode)->addByteSegment('testdata')->getMatrix();
144+
$matrix = (new QRCode)->addByteSegment('testdata')->getQRMatrix();
145145

146146
$this::assertInstanceOf(MaskPattern::class, $matrix->getMaskPattern());
147147
$this::assertSame(MaskPattern::PATTERN_100, $matrix->getMaskPattern()->getPattern());
@@ -378,7 +378,7 @@ public function testSetLogoSpaceOmitHeight():void{
378378
$o->addLogoSpace = true;
379379
$o->logoSpaceHeight = 5;
380380

381-
$matrix = (new QRCode($o))->addByteSegment('testdata')->getMatrix();
381+
$matrix = (new QRCode($o))->addByteSegment('testdata')->getQRMatrix();
382382

383383
self::debugMatrix($matrix);
384384

@@ -398,7 +398,7 @@ public function testSetLogoSpaceOrientation():void{
398398
$o->eccLevel = EccLevel::H;
399399
$o->addQuietzone = false;
400400

401-
$matrix = (new QRCode($o))->addByteSegment('testdata')->getMatrix();
401+
$matrix = (new QRCode($o))->addByteSegment('testdata')->getQRMatrix();
402402
// also testing size adjustment to uneven numbers
403403
$matrix->setLogoSpace(20, 14);
404404

@@ -423,7 +423,7 @@ public function testSetLogoSpacePosition():void{
423423
$o->addQuietzone = true;
424424
$o->quietzoneSize = 10;
425425

426-
$matrix = (new QRCode($o))->addByteSegment('testdata')->getMatrix();
426+
$matrix = (new QRCode($o))->addByteSegment('testdata')->getQRMatrix();
427427

428428
self::debugMatrix($matrix);
429429

@@ -453,7 +453,7 @@ public function testSetLogoSpaceInvalidEccException():void{
453453
$this->expectException(QRCodeDataException::class);
454454
$this->expectExceptionMessage('ECC level "H" required to add logo space');
455455

456-
(new QRCode)->addByteSegment('testdata')->getMatrix()->setLogoSpace(50, 50);
456+
(new QRCode)->addByteSegment('testdata')->getQRMatrix()->setLogoSpace(50, 50);
457457
}
458458

459459
/**
@@ -467,7 +467,7 @@ public function testSetLogoSpaceExceedsException():void{
467467
$o->version = 5;
468468
$o->eccLevel = EccLevel::H;
469469

470-
(new QRCode($o))->addByteSegment('testdata')->getMatrix()->setLogoSpace(69, 1);
470+
(new QRCode($o))->addByteSegment('testdata')->getQRMatrix()->setLogoSpace(69, 1);
471471
}
472472

473473
/**
@@ -481,7 +481,7 @@ public function testSetLogoSpaceMaxSizeException():void{
481481
$o->version = 5;
482482
$o->eccLevel = EccLevel::H;
483483

484-
(new QRCode($o))->addByteSegment('testdata')->getMatrix()->setLogoSpace(37, 37);
484+
(new QRCode($o))->addByteSegment('testdata')->getQRMatrix()->setLogoSpace(37, 37);
485485
}
486486

487487
/**

tests/QRCodeReaderTestAbstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function testReader(string $img, string $expected, bool $grayscale):void{
8585
/** @noinspection PhpUndefinedMethodInspection */
8686
$result = (new QRCode)->readFromSource($this->FQN::fromFile(__DIR__.'/samples/'.$img, $this->options));
8787

88-
QRMatrixTest::debugMatrix($result->getMatrix());
88+
QRMatrixTest::debugMatrix($result->getQRMatrix());
8989

9090
$this::assertSame($expected, (string)$result);
9191
}

0 commit comments

Comments
 (0)