diff --git a/examples/imageWithLogo.php b/examples/imageWithLogo.php index 011a48627..42d355932 100644 --- a/examples/imageWithLogo.php +++ b/examples/imageWithLogo.php @@ -57,7 +57,7 @@ class QRImageWithLogo extends QRGdImagePNG{ $lh = (($this->options->logoSpaceHeight - 2) * $this->options->scale); // get the qrcode size - $ql = ($this->matrix->getSize() * $this->options->scale); + $ql = ($this->matrix->moduleCount * $this->options->scale); // scale the logo and copy it over. done! imagecopyresampled($this->image, $im, (($ql - $lw) / 2), (($ql - $lh) / 2), 0, 0, $lw, $lh, $w, $h); diff --git a/examples/svgMeltedModules.php b/examples/svgMeltedModules.php index fb660d27c..02a63d251 100644 --- a/examples/svgMeltedModules.php +++ b/examples/svgMeltedModules.php @@ -37,7 +37,7 @@ class MeltedSVGQRCodeOutput extends QRMarkupSVG{ $melt = $this->options->melt; // avoid magic getter in long loops // collect the modules for each type - foreach($this->matrix->getMatrix() as $y => $row){ + foreach($this->matrix->matrix as $y => $row){ foreach($row as $x => $M_TYPE){ $M_TYPE_LAYER = $M_TYPE; diff --git a/examples/svgModuleGroupShape.php b/examples/svgModuleGroupShape.php index 07470a6dc..1ed5840df 100644 --- a/examples/svgModuleGroupShape.php +++ b/examples/svgModuleGroupShape.php @@ -34,7 +34,7 @@ class GroupShapeSVGQRCodeOutput extends QRMarkupSVG{ $melt = $this->options->melt; // avoid magic getter in long loops // collect the modules for each type - foreach($this->matrix->getMatrix() as $y => $row){ + foreach($this->matrix->matrix as $y => $row){ foreach($row as $x => $M_TYPE){ $M_TYPE_LAYER = $M_TYPE; diff --git a/examples/svgRandomColoredDots.php b/examples/svgRandomColoredDots.php index d6f74ba42..a1cdfdc52 100644 --- a/examples/svgRandomColoredDots.php +++ b/examples/svgRandomColoredDots.php @@ -42,7 +42,7 @@ class RandomDotsSVGOutput extends QRMarkupSVG{ $dotColors = $this->options->dotColors; // avoid magic getter in long loops // collect the modules for each type - foreach($this->matrix->getMatrix() as $y => $row){ + foreach($this->matrix->matrix as $y => $row){ foreach($row as $x => $M_TYPE){ $M_TYPE_LAYER = $M_TYPE; diff --git a/examples/svgRoundQuietzone.php b/examples/svgRoundQuietzone.php index 00922da3d..7f622d40a 100644 --- a/examples/svgRoundQuietzone.php +++ b/examples/svgRoundQuietzone.php @@ -163,7 +163,7 @@ class RoundQuietzoneSVGoutput extends QRMarkupSVG{ $dotColors = $this->options->dotColors; // avoid magic getter in long loops // collect the modules for each type - foreach($this->matrix->getMatrix() as $y => $row){ + foreach($this->matrix->matrix as $y => $row){ foreach($row as $x => $M_TYPE){ $M_TYPE_LAYER = $M_TYPE; diff --git a/src/Common/MaskPattern.php b/src/Common/MaskPattern.php index 832a6bf4b..d04be4839 100644 --- a/src/Common/MaskPattern.php +++ b/src/Common/MaskPattern.php @@ -118,7 +118,7 @@ final class MaskPattern{ */ public static function getBestPattern(QRMatrix $QRMatrix):self{ $penalties = []; - $size = $QRMatrix->getSize(); + $size = $QRMatrix->moduleCount; foreach(self::PATTERNS as $pattern){ $mp = new self($pattern); diff --git a/src/Data/QRMatrix.php b/src/Data/QRMatrix.php index c2e598d43..47a8c2290 100755 --- a/src/Data/QRMatrix.php +++ b/src/Data/QRMatrix.php @@ -79,12 +79,12 @@ class QRMatrix{ /** * the matrix version - always set in QRMatrix, may be null in BitMatrix */ - protected Version|null $version = null; + protected(set) Version|null $version = null; /** * the current ECC level - always set in QRMatrix, may be null in BitMatrix */ - protected EccLevel|null $eccLevel = null; + protected(set) EccLevel|null $eccLevel = null; /** * the mask pattern that was used in the most recent operation, set via: @@ -93,19 +93,21 @@ class QRMatrix{ * - QRMatrix::mask() * - BitMatrix::readFormatInformation() */ - protected MaskPattern|null $maskPattern = null; + protected(set) MaskPattern|null $maskPattern = null; /** * the size (side length) of the matrix, including quiet zone (if created) + * + * size = version * 4 + 17 [ + 2 * quietzone size] */ - protected int $moduleCount; + protected(set) int $moduleCount; /** * the actual matrix data array * * @var int[][] */ - protected array $matrix; + protected(set) array $matrix; /** * QRMatrix constructor. @@ -141,15 +143,6 @@ class QRMatrix{ ; } - /** - * Returns the data matrix - * - * @return int[][] - */ - public function getMatrix():array{ - return $this->matrix; - } - /** * Returns a boolean representation of the data matrix * @@ -166,36 +159,6 @@ class QRMatrix{ return $matrix; } - /** - * Returns the current version number - */ - public function getVersion():Version|null{ - return $this->version; - } - - /** - * Returns the current ECC level - */ - public function getEccLevel():EccLevel|null{ - return $this->eccLevel; - } - - /** - * Returns the current mask pattern - */ - public function getMaskPattern():MaskPattern|null{ - return $this->maskPattern; - } - - /** - * Returns the absoulute size of the matrix, including quiet zone (after setting it). - * - * size = version * 4 + 17 [ + 2 * quietzone size] - */ - public function getSize():int{ - return $this->moduleCount; - } - /** * Returns the value of the module at position [$x, $y] or -1 if the coordinate is outside the matrix */ diff --git a/src/Decoder/Decoder.php b/src/Decoder/Decoder.php index 5fd6427e9..465a00b44 100644 --- a/src/Decoder/Decoder.php +++ b/src/Decoder/Decoder.php @@ -87,9 +87,9 @@ final class Decoder{ private function decodeMatrix(BitMatrix $matrix):DecoderResult{ // Read raw codewords $rawCodewords = $matrix->readCodewords(); - $this->version = $matrix->getVersion(); - $this->eccLevel = $matrix->getEccLevel(); - $this->maskPattern = $matrix->getMaskPattern(); + $this->version = $matrix->version; + $this->eccLevel = $matrix->eccLevel; + $this->maskPattern = $matrix->maskPattern; if($this->version === null || $this->eccLevel === null || $this->maskPattern === null){ throw new QRCodeDecoderException('unable to read version or format info'); // @codeCoverageIgnore diff --git a/src/Detector/AlignmentPatternFinder.php b/src/Detector/AlignmentPatternFinder.php index 7c2b09049..13f4e4a75 100644 --- a/src/Detector/AlignmentPatternFinder.php +++ b/src/Detector/AlignmentPatternFinder.php @@ -221,7 +221,7 @@ final class AlignmentPatternFinder{ * returns vertical center of alignment pattern, or null if not found */ private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal):float|null{ - $maxI = $this->matrix->getSize(); + $maxI = $this->matrix->moduleCount; $stateCount = []; $stateCount[0] = 0; $stateCount[1] = 0; diff --git a/src/Detector/Detector.php b/src/Detector/Detector.php index 9cabc5553..93dcc48b2 100644 --- a/src/Detector/Detector.php +++ b/src/Detector/Detector.php @@ -135,7 +135,7 @@ final class Detector{ */ private function sizeOfBlackWhiteBlackRunBothWays(float $fromX, float $fromY, float $toX, float $toY):float{ $result = $this->sizeOfBlackWhiteBlackRun((int)$fromX, (int)$fromY, (int)$toX, (int)$toY); - $dimension = $this->matrix->getSize(); + $dimension = $this->matrix->moduleCount; // Now count other way -- don't run off image though of course $scale = 1.0; $otherToX = ($fromX - ($toX - $fromX)); @@ -289,7 +289,7 @@ final class Detector{ float $allowanceFactor, ):AlignmentPattern|null{ // Look for an alignment pattern (3 modules in size) around where it should be - $dimension = $this->matrix->getSize(); + $dimension = $this->matrix->moduleCount; $allowance = (int)($allowanceFactor * $overallEstModuleSize); $alignmentAreaLeftX = max(0, ($estAlignmentX - $allowance)); $alignmentAreaRightX = min(($dimension - 1), ($estAlignmentX + $allowance)); diff --git a/src/Detector/FinderPatternFinder.php b/src/Detector/FinderPatternFinder.php index ca594ee83..0d5157588 100644 --- a/src/Detector/FinderPatternFinder.php +++ b/src/Detector/FinderPatternFinder.php @@ -50,7 +50,7 @@ final class FinderPatternFinder{ * @return \chillerlan\QRCode\Detector\FinderPattern[] */ public function find():array{ - $dimension = $this->matrix->getSize(); + $dimension = $this->matrix->moduleCount; // We are looking for black/white/black/white/black modules in // 1:1:3:1:1 ratio; this tracks the number of such modules seen so far @@ -280,7 +280,7 @@ final class FinderPatternFinder{ return false; } - $dimension = $this->matrix->getSize(); + $dimension = $this->matrix->moduleCount; // Now also count down, right from center $i = 1; @@ -329,7 +329,7 @@ final class FinderPatternFinder{ * @noinspection DuplicatedCode */ private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal):float|null{ - $maxI = $this->matrix->getSize(); + $maxI = $this->matrix->moduleCount; $stateCount = self::crossCheckStateCount; // Start counting up from center @@ -413,7 +413,7 @@ final class FinderPatternFinder{ * @noinspection DuplicatedCode */ private function crossCheckHorizontal(int $startJ, int $centerI, int $maxCount, int $originalStateCountTotal):float|null{ - $maxJ = $this->matrix->getSize(); + $maxJ = $this->matrix->moduleCount; $stateCount = self::crossCheckStateCount; $j = $startJ; diff --git a/src/Detector/GridSampler.php b/src/Detector/GridSampler.php index ac7764405..030a2ded9 100644 --- a/src/Detector/GridSampler.php +++ b/src/Detector/GridSampler.php @@ -150,7 +150,7 @@ final class GridSampler{ [$this->points, ] = $transform->transformPoints($this->points); // Quick check to see if points transformed to something inside the image; // sufficient to check the endpoints - $this->checkAndNudgePoints($matrix->getSize()); + $this->checkAndNudgePoints($matrix->moduleCount); // no need to try/catch as QRMatrix::set() will silently discard out of bounds values # try{ diff --git a/src/Output/QRFpdf.php b/src/Output/QRFpdf.php index 8ee105cb3..784100a0c 100644 --- a/src/Output/QRFpdf.php +++ b/src/Output/QRFpdf.php @@ -77,7 +77,7 @@ class QRFpdf extends QROutputAbstract{ $this->prevColor = null; - foreach($this->matrix->getMatrix() as $y => $row){ + foreach($this->matrix->matrix as $y => $row){ foreach($row as $x => $M_TYPE){ $this->module($x, $y, $M_TYPE); } diff --git a/src/Output/QRGdImage.php b/src/Output/QRGdImage.php index 73495ca59..47feb4a01 100644 --- a/src/Output/QRGdImage.php +++ b/src/Output/QRGdImage.php @@ -263,7 +263,7 @@ abstract class QRGdImage extends QROutputAbstract{ * Draws the QR image */ protected function drawImage():void{ - foreach($this->matrix->getMatrix() as $y => $row){ + foreach($this->matrix->matrix as $y => $row){ foreach($row as $x => $M_TYPE){ $this->module($x, $y, $M_TYPE); } diff --git a/src/Output/QRImagick.php b/src/Output/QRImagick.php index e7be0d1af..a6a1b6503 100644 --- a/src/Output/QRImagick.php +++ b/src/Output/QRImagick.php @@ -183,7 +183,7 @@ class QRImagick extends QROutputAbstract{ $this->imagickDraw = new ImagickDraw; $this->imagickDraw->setStrokeWidth(0); - foreach($this->matrix->getMatrix() as $y => $row){ + foreach($this->matrix->matrix as $y => $row){ foreach($row as $x => $M_TYPE){ $this->module($x, $y, $M_TYPE); } diff --git a/src/Output/QRInterventionImage.php b/src/Output/QRInterventionImage.php index af8b6a294..461fa9dd9 100644 --- a/src/Output/QRInterventionImage.php +++ b/src/Output/QRInterventionImage.php @@ -102,7 +102,7 @@ class QRInterventionImage extends QROutputAbstract{ $this->image->fill($this->prepareModuleValue($this->options->bgColor)); } - foreach($this->matrix->getMatrix() as $y => $row){ + foreach($this->matrix->matrix as $y => $row){ foreach($row as $x => $M_TYPE){ $this->module($x, $y, $M_TYPE); } diff --git a/src/Output/QRMarkupHTML.php b/src/Output/QRMarkupHTML.php index 11a0d2058..10e182d32 100644 --- a/src/Output/QRMarkupHTML.php +++ b/src/Output/QRMarkupHTML.php @@ -24,7 +24,7 @@ class QRMarkupHTML extends QRMarkup{ $rows = []; $cssClass = $this->getCssClass(); - foreach($this->matrix->getMatrix() as $row){ + foreach($this->matrix->matrix as $row){ $element = ''; $modules = array_map(fn(int $M_TYPE):string => sprintf($element, $this->getModuleValue($M_TYPE)), $row); diff --git a/src/Output/QRMarkupXML.php b/src/Output/QRMarkupXML.php index 1e946dd97..a68ae554d 100644 --- a/src/Output/QRMarkupXML.php +++ b/src/Output/QRMarkupXML.php @@ -55,8 +55,8 @@ class QRMarkupXML extends QRMarkup{ $root->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); $root->setAttribute('xsi:noNamespaceSchemaLocation', $this::SCHEMA); - $root->setAttribute('version', (string)$this->matrix->getVersion()); - $root->setAttribute('eccLevel', (string)$this->matrix->getEccLevel()); + $root->setAttribute('version', (string)$this->matrix->version); + $root->setAttribute('eccLevel', (string)$this->matrix->eccLevel); $root->appendChild($this->createMatrix()); $this->dom->appendChild($root); @@ -76,15 +76,15 @@ class QRMarkupXML extends QRMarkup{ protected function createMatrix():DOMElement{ [$width, $height] = $this->getOutputDimensions(); $matrix = $this->dom->createElement('matrix'); - $dimension = $this->matrix->getVersion()->getDimension(); + $dimension = $this->matrix->version->getDimension(); $matrix->setAttribute('size', (string)$dimension); $matrix->setAttribute('quietzoneSize', (string)(int)(($this->moduleCount - $dimension) / 2)); - $matrix->setAttribute('maskPattern', (string)$this->matrix->getMaskPattern()->getPattern()); + $matrix->setAttribute('maskPattern', (string)$this->matrix->maskPattern->getPattern()); $matrix->setAttribute('width', (string)$width); $matrix->setAttribute('height', (string)$height); - foreach($this->matrix->getMatrix() as $y => $row){ + foreach($this->matrix->matrix as $y => $row){ $matrixRow = $this->row($y, $row); if($matrixRow !== null){ diff --git a/src/Output/QROutputAbstract.php b/src/Output/QROutputAbstract.php index ce09bc2dd..6df326b8f 100644 --- a/src/Output/QROutputAbstract.php +++ b/src/Output/QROutputAbstract.php @@ -28,7 +28,7 @@ abstract class QROutputAbstract implements QROutputInterface{ /** * the current size of the QR matrix * - * @see \chillerlan\QRCode\Data\QRMatrix::getSize() + * @see \chillerlan\QRCode\Data\QRMatrix::$moduleCount */ protected int $moduleCount; @@ -130,7 +130,7 @@ abstract class QROutputAbstract implements QROutputInterface{ * Call this method if you modify the matrix from within your custom module in case the dimensions have been changed */ protected function setMatrixDimensions():void{ - $this->moduleCount = $this->matrix->getSize(); + $this->moduleCount = $this->matrix->moduleCount; $this->scale = $this->options->scale; $this->length = ($this->moduleCount * $this->scale); } @@ -268,7 +268,7 @@ abstract class QROutputAbstract implements QROutputInterface{ $paths = []; // collect the modules for each type - foreach($this->matrix->getMatrix() as $y => $row){ + foreach($this->matrix->matrix as $y => $row){ foreach($row as $x => $M_TYPE){ $M_TYPE_LAYER = $M_TYPE; diff --git a/src/Output/QRStringJSON.php b/src/Output/QRStringJSON.php index 1803531d7..d721167bc 100644 --- a/src/Output/QRStringJSON.php +++ b/src/Output/QRStringJSON.php @@ -44,18 +44,18 @@ class QRStringJSON extends QROutputAbstract{ */ public function dump(string|null $file = null):string{ [$width, $height] = $this->getOutputDimensions(); - $version = $this->matrix->getVersion(); + $version = $this->matrix->version; $dimension = $version->getDimension(); $json = [ '$schema' => $this::SCHEMA, 'qrcode' => [ 'version' => $version->getVersionNumber(), - 'eccLevel' => (string)$this->matrix->getEccLevel(), + 'eccLevel' => (string)$this->matrix->eccLevel, 'matrix' => [ 'size' => $dimension, 'quietzoneSize' => (int)(($this->moduleCount - $dimension) / 2), - 'maskPattern' => $this->matrix->getMaskPattern()->getPattern(), + 'maskPattern' => $this->matrix->maskPattern->getPattern(), 'width' => $width, 'height' => $height, 'rows' => [], @@ -63,7 +63,7 @@ class QRStringJSON extends QROutputAbstract{ ], ]; - foreach($this->matrix->getMatrix() as $y => $row){ + foreach($this->matrix->matrix as $y => $row){ $matrixRow = $this->row($y, $row); if($matrixRow !== null){ diff --git a/src/Output/QRStringText.php b/src/Output/QRStringText.php index af2d99c7a..1437a6f51 100644 --- a/src/Output/QRStringText.php +++ b/src/Output/QRStringText.php @@ -36,7 +36,7 @@ class QRStringText extends QROutputAbstract{ $lines = []; $linestart = $this->options->textLineStart; - foreach($this->matrix->getMatrix() as $row){ + foreach($this->matrix->matrix as $row){ $lines[] = $linestart.implode('', array_map($this->getModuleValue(...), $row)); } diff --git a/tests/Data/DataInterfaceTestAbstract.php b/tests/Data/DataInterfaceTestAbstract.php index 4af387dbd..02022978b 100644 --- a/tests/Data/DataInterfaceTestAbstract.php +++ b/tests/Data/DataInterfaceTestAbstract.php @@ -59,7 +59,7 @@ abstract class DataInterfaceTestAbstract extends TestCase{ $matrix = $this->QRData->writeMatrix()->setFormatInfo($maskPattern)->mask($maskPattern); $this::assertInstanceOf(QRMatrix::class, $matrix); - $this::assertSame($pattern, $matrix->getMaskPattern()->getPattern()); + $this::assertSame($pattern, $matrix->maskPattern->getPattern()); } /** diff --git a/tests/Data/QRDataTest.php b/tests/Data/QRDataTest.php index 42c9efd0d..c853211cd 100644 --- a/tests/Data/QRDataTest.php +++ b/tests/Data/QRDataTest.php @@ -47,7 +47,7 @@ final class QRDataTest extends TestCase{ $matrix->setFormatInfo($maskPattern)->mask($maskPattern); - $this::assertSame(3, $matrix->getVersion()->getVersionNumber()); + $this::assertSame(3, $matrix->version->getVersionNumber()); // attempt to read $options->outputBase64 = false; diff --git a/tests/Data/QRMatrixTest.php b/tests/Data/QRMatrixTest.php index f6d836d3f..2bd0cf514 100755 --- a/tests/Data/QRMatrixTest.php +++ b/tests/Data/QRMatrixTest.php @@ -43,7 +43,7 @@ final class QRMatrixTest extends TestCase{ */ #[Test] public function getSize():void{ - $this::assertCount($this->matrix->getSize(), $this->matrix->getBooleanMatrix()); + $this::assertCount($this->matrix->moduleCount, $this->matrix->getBooleanMatrix()); } /** @@ -51,7 +51,7 @@ final class QRMatrixTest extends TestCase{ */ #[Test] public function getVersion():void{ - $this::assertSame($this::version, $this->matrix->getVersion()->getVersionNumber()); + $this::assertSame($this::version, $this->matrix->version->getVersionNumber()); } /** @@ -59,7 +59,7 @@ final class QRMatrixTest extends TestCase{ */ #[Test] public function getECC():void{ - $this::assertSame(EccLevel::L, $this->matrix->getEccLevel()->getLevel()); + $this::assertSame(EccLevel::L, $this->matrix->eccLevel->getLevel()); } /** @@ -70,8 +70,8 @@ final class QRMatrixTest extends TestCase{ // set via matrix evaluation $matrix = new QRCode()->addByteSegment('testdata')->getQRMatrix(); - $this::assertInstanceOf(MaskPattern::class, $matrix->getMaskPattern()); - $this::assertSame(MaskPattern::PATTERN_100, $matrix->getMaskPattern()->getPattern()); + $this::assertInstanceOf(MaskPattern::class, $matrix->maskPattern); + $this::assertSame(MaskPattern::PATTERN_100, $matrix->maskPattern->getPattern()); } /** @@ -120,7 +120,7 @@ final class QRMatrixTest extends TestCase{ $this->dm($matrix); - $this::assertSame(QRMatrix::M_DARKMODULE, $matrix->get(8, ($matrix->getSize() - 8))); + $this::assertSame(QRMatrix::M_DARKMODULE, $matrix->get(8, ($matrix->moduleCount - 8))); } /** @@ -134,8 +134,8 @@ final class QRMatrixTest extends TestCase{ $this->dm($matrix); $this::assertSame(QRMatrix::M_FINDER_DARK, $matrix->get(0, 0)); - $this::assertSame(QRMatrix::M_FINDER_DARK, $matrix->get(0, ($matrix->getSize() - 1))); - $this::assertSame(QRMatrix::M_FINDER_DARK, $matrix->get(($matrix->getSize() - 1), 0)); + $this::assertSame(QRMatrix::M_FINDER_DARK, $matrix->get(0, ($matrix->moduleCount - 1))); + $this::assertSame(QRMatrix::M_FINDER_DARK, $matrix->get(($matrix->moduleCount - 1), 0)); } /** @@ -150,8 +150,8 @@ final class QRMatrixTest extends TestCase{ $this::assertSame(QRMatrix::M_SEPARATOR, $matrix->get(7, 0)); $this::assertSame(QRMatrix::M_SEPARATOR, $matrix->get(0, 7)); - $this::assertSame(QRMatrix::M_SEPARATOR, $matrix->get(0, ($matrix->getSize() - 8))); - $this::assertSame(QRMatrix::M_SEPARATOR, $matrix->get(($matrix->getSize() - 8), 0)); + $this::assertSame(QRMatrix::M_SEPARATOR, $matrix->get(0, ($matrix->moduleCount - 8))); + $this::assertSame(QRMatrix::M_SEPARATOR, $matrix->get(($matrix->moduleCount - 8), 0)); } /** @@ -160,7 +160,7 @@ final class QRMatrixTest extends TestCase{ #[Test] #[DataProvider('matrixProvider')] public function setAlignmentPattern(QRMatrix $matrix):void{ - $version = $matrix->getVersion(); + $version = $matrix->version; if($version->getVersionNumber() === 1){ $this::markTestSkipped('N/A (Version 1 has no alignment pattern)'); @@ -201,7 +201,7 @@ final class QRMatrixTest extends TestCase{ $this->dm($matrix); - $size = $matrix->getSize(); + $size = $matrix->moduleCount; for($i = 7; $i < ($size - 7); $i++){ if(($i % 2) === 0){ @@ -222,7 +222,7 @@ final class QRMatrixTest extends TestCase{ #[DataProvider('matrixProvider')] public function setVersionNumber(QRMatrix $matrix):void{ - if($matrix->getVersion()->getVersionNumber() < 7){ + if($matrix->version->getVersionNumber() < 7){ $this::markTestSkipped('N/A (Version < 7)'); } @@ -230,10 +230,10 @@ final class QRMatrixTest extends TestCase{ $this->dm($matrix); - $this::assertTrue($matrix->checkType(($matrix->getSize() - 9), 0, QRMatrix::M_VERSION)); - $this::assertTrue($matrix->checkType(($matrix->getSize() - 11), 5, QRMatrix::M_VERSION)); - $this::assertTrue($matrix->checkType(0, ($matrix->getSize() - 9), QRMatrix::M_VERSION)); - $this::assertTrue($matrix->checkType(5, ($matrix->getSize() - 11), QRMatrix::M_VERSION)); + $this::assertTrue($matrix->checkType(($matrix->moduleCount - 9), 0, QRMatrix::M_VERSION)); + $this::assertTrue($matrix->checkType(($matrix->moduleCount - 11), 5, QRMatrix::M_VERSION)); + $this::assertTrue($matrix->checkType(0, ($matrix->moduleCount - 9), QRMatrix::M_VERSION)); + $this::assertTrue($matrix->checkType(5, ($matrix->moduleCount - 11), QRMatrix::M_VERSION)); } /** @@ -248,8 +248,8 @@ final class QRMatrixTest extends TestCase{ $this::assertTrue($matrix->checkType(8, 0, QRMatrix::M_FORMAT)); $this::assertTrue($matrix->checkType(0, 8, QRMatrix::M_FORMAT)); - $this::assertTrue($matrix->checkType(($matrix->getSize() - 1), 8, QRMatrix::M_FORMAT)); - $this::assertTrue($matrix->checkType(($matrix->getSize() - 8), 8, QRMatrix::M_FORMAT)); + $this::assertTrue($matrix->checkType(($matrix->moduleCount - 1), 8, QRMatrix::M_FORMAT)); + $this::assertTrue($matrix->checkType(($matrix->moduleCount - 8), 8, QRMatrix::M_FORMAT)); } /** @@ -258,7 +258,7 @@ final class QRMatrixTest extends TestCase{ #[Test] #[DataProvider('matrixProvider')] public function setQuietZone(QRMatrix $matrix):void{ - $size = $matrix->getSize(); + $size = $matrix->moduleCount; $quietZoneSize = 5; $matrix->set(0, 0, true, QRMatrix::M_LOGO); @@ -271,7 +271,7 @@ final class QRMatrixTest extends TestCase{ $this::assertCount($s, $matrix->getBooleanMatrix()); $this::assertCount($s, $matrix->getBooleanMatrix()[($size - 1)]); - $size = $matrix->getSize(); + $size = $matrix->moduleCount; $this->dm($matrix); @@ -304,9 +304,9 @@ final class QRMatrixTest extends TestCase{ $matrix->initFunctionalPatterns(); // matrix size - $size = $matrix->getSize(); + $size = $matrix->moduleCount; // quiet zone size - $qz = (($size - $matrix->getVersion()->getDimension()) / 2); + $qz = (($size - $matrix->version->getDimension()) / 2); // initial dark module position $this::assertSame(QRMatrix::M_DARKMODULE, $matrix->get((8 + $qz), ($size - 8 - $qz))); diff --git a/tests/Traits/QRMatrixDebugTrait.php b/tests/Traits/QRMatrixDebugTrait.php index d86155cc2..0bdeb0885 100644 --- a/tests/Traits/QRMatrixDebugTrait.php +++ b/tests/Traits/QRMatrixDebugTrait.php @@ -85,7 +85,7 @@ trait QRMatrixDebugTrait{ // limit /** @noinspection PhpUndefinedConstantInspection - see phpunit.xml.dist */ - if(!defined('MATRIX_DEBUG_VERSION') || $matrix->getVersion()->getVersionNumber() !== MATRIX_DEBUG_VERSION){ + if(!defined('MATRIX_DEBUG_VERSION') || $matrix->version->getVersionNumber() !== MATRIX_DEBUG_VERSION){ return; }