From 28b6e2c41826ba90684a4b48f21e29f60752f6f0 Mon Sep 17 00:00:00 2001 From: smiley Date: Thu, 15 Jun 2023 17:15:33 +0200 Subject: [PATCH] :octocat: --- examples/reader.php | 4 ++-- examples/svgMeltedModules.php | 3 ++- examples/svgRandomColoredDots.php | 2 +- examples/svgRoundQuietzone.php | 6 +++--- src/Output/QRMarkup.php | 3 ++- src/Output/QROutputAbstract.php | 2 +- tests/Data/QRMatrixTest.php | 2 +- 7 files changed, 12 insertions(+), 10 deletions(-) diff --git a/examples/reader.php b/examples/reader.php index 059206113..6a2f1073a 100644 --- a/examples/reader.php +++ b/examples/reader.php @@ -15,8 +15,8 @@ require_once __DIR__.'/../vendor/autoload.php'; // please excuse the IDE yelling https://youtrack.jetbrains.com/issue/WI-66549 $options = new QROptions; $options->readerUseImagickIfAvailable = false; -$options->readerGrayscale = true; -$options->readerIncreaseContrast = true; +$options->readerGrayscale = true; +$options->readerIncreaseContrast = true; try{ $result = (new QRCode($options))->readFromFile(__DIR__.'/../.github/images/example_image.png'); diff --git a/examples/svgMeltedModules.php b/examples/svgMeltedModules.php index 4a0808f7e..86ed2bbc8 100644 --- a/examples/svgMeltedModules.php +++ b/examples/svgMeltedModules.php @@ -5,6 +5,7 @@ * eliminate hairline antialias "cracks" that tend to appear when two SVG paths are exactly adjacent to each other. * * @see https://github.com/chillerlan/php-qrcode/issues/127 + * @see ./shapes.svg */ use chillerlan\QRCode\{QRCode, QROptions}; @@ -48,7 +49,7 @@ class MeltedSVGQRCodeOutput extends QRMarkupSVG{ $M_TYPE_LAYER = QRMatrix::M_DATA; if($this->matrix->check($x, $y)){ - $M_TYPE_LAYER |= QRMatrix::IS_DARK; + $M_TYPE_LAYER = QRMatrix::M_DATA_DARK; } } diff --git a/examples/svgRandomColoredDots.php b/examples/svgRandomColoredDots.php index 772afe41a..7faf64089 100644 --- a/examples/svgRandomColoredDots.php +++ b/examples/svgRandomColoredDots.php @@ -53,7 +53,7 @@ class RandomDotsSVGOutput extends QRMarkupSVG{ $M_TYPE_LAYER = QRMatrix::M_DATA; if($this->matrix->check($x, $y)){ - $M_TYPE_LAYER |= QRMatrix::IS_DARK; + $M_TYPE_LAYER = QRMatrix::M_DATA_DARK; } } diff --git a/examples/svgRoundQuietzone.php b/examples/svgRoundQuietzone.php index a0a1312a4..fd8749c0a 100644 --- a/examples/svgRoundQuietzone.php +++ b/examples/svgRoundQuietzone.php @@ -44,7 +44,7 @@ class RoundQuietzoneSVGoutput extends QRMarkupSVG{ $this->colorQuietzone($quietzoneSize, ($diameter / 2)); // calculate the logo space - $logoSpaceSize = (int)ceil($this->moduleCount * $this->options->svgLogoScale); + $logoSpaceSize = (int)(ceil($this->moduleCount * $this->options->svgLogoScale) + 1); // we're calling QRMatrix::setLogoSpace() manually, so QROptions::$addLogoSpace has no effect here $this->matrix->setLogoSpace($logoSpaceSize); @@ -185,7 +185,7 @@ class RoundQuietzoneSVGoutput extends QRMarkupSVG{ $M_TYPE_LAYER = QRMatrix::M_DATA; if($this->matrix->check($x, $y)){ - $M_TYPE_LAYER |= QRMatrix::IS_DARK; + $M_TYPE_LAYER = QRMatrix::M_DATA_DARK; } } @@ -335,7 +335,7 @@ $options = new RoundQuietzoneOptions([ QRMatrix::M_FINDER_DARK, QRMatrix::M_FINDER_DOT, QRMatrix::M_ALIGNMENT_DARK, - (QRMatrix::M_QUIETZONE | QRMatrix::IS_DARK), + QRMatrix::M_QUIETZONE_DARK, ], 'drawCircularModules' => true, 'circleRadius' => 0.4, diff --git a/src/Output/QRMarkup.php b/src/Output/QRMarkup.php index 9566b4fc9..d963fdfb3 100644 --- a/src/Output/QRMarkup.php +++ b/src/Output/QRMarkup.php @@ -87,7 +87,8 @@ abstract class QRMarkup extends QROutputAbstract{ } /** - * + * returns the fully parsed and rendered markup string for the given input */ abstract protected function createMarkup(bool $saveToFile):string; + } diff --git a/src/Output/QROutputAbstract.php b/src/Output/QROutputAbstract.php index 50cff7caf..b2b4660c8 100644 --- a/src/Output/QROutputAbstract.php +++ b/src/Output/QROutputAbstract.php @@ -187,7 +187,7 @@ abstract class QROutputAbstract implements QROutputInterface{ $M_TYPE_LAYER = QRMatrix::M_DATA; if($this->matrix->check($x, $y)){ - $M_TYPE_LAYER |= QRMatrix::IS_DARK; + $M_TYPE_LAYER = QRMatrix::M_DATA_DARK; } } diff --git a/tests/Data/QRMatrixTest.php b/tests/Data/QRMatrixTest.php index 1b0d87ec6..dfc73fac9 100755 --- a/tests/Data/QRMatrixTest.php +++ b/tests/Data/QRMatrixTest.php @@ -176,7 +176,7 @@ final class QRMatrixTest extends TestCase{ public static function matrixProvider():Generator{ $ecc = new EccLevel(EccLevel::L); - foreach(range(1, 40) as $i){ + for($i = 1; $i <= 40; $i++){ yield 'version: '.$i => [new QRMatrix(new Version($i), $ecc)]; } }