diff --git a/src/Data/QRMatrix.php b/src/Data/QRMatrix.php index bd93f7fec..15cc3fcd4 100755 --- a/src/Data/QRMatrix.php +++ b/src/Data/QRMatrix.php @@ -211,17 +211,18 @@ class QRMatrix{ } /** - * checks whether a module matches one of the given $M_TYPES + * checks whether the module at ($x, $y) is not in the given array of $M_TYPES, + * returns true if no matches are found, otherwise false. */ - public function checkTypes(int $x, int $y, array $M_TYPES):bool{ + public function checkTypeNotIn(int $x, int $y, array $M_TYPES):bool{ foreach($M_TYPES as $type){ if($this->checkType($x, $y, $type)){ - return true; + return false; } } - return false; + return true; } /** diff --git a/src/Output/QRGdImage.php b/src/Output/QRGdImage.php index fac2f09ca..3b0ae3ee6 100644 --- a/src/Output/QRGdImage.php +++ b/src/Output/QRGdImage.php @@ -147,7 +147,7 @@ class QRGdImage extends QROutputAbstract{ /** @phan-suppress-next-line PhanParamTooFewInternalUnpack */ $color = imagecolorallocate($this->image, ...$this->moduleValues[$M_TYPE]); - $this->options->drawCircularModules && !$this->matrix->checkTypes($x, $y, $this->options->keepAsSquare) + $this->options->drawCircularModules && $this->matrix->checkTypeNotIn($x, $y, $this->options->keepAsSquare) ? imagefilledellipse( $this->image, ($x * $this->scale) + ($this->scale / 2), diff --git a/src/Output/QRImagick.php b/src/Output/QRImagick.php index 762707774..21d4c3912 100644 --- a/src/Output/QRImagick.php +++ b/src/Output/QRImagick.php @@ -121,7 +121,7 @@ class QRImagick extends QROutputAbstract{ $this->imagickDraw->setStrokeColor($this->moduleValues[$M_TYPE]); $this->imagickDraw->setFillColor($this->moduleValues[$M_TYPE]); - $this->options->drawCircularModules && !$this->matrix->checkTypes($x, $y, $this->options->keepAsSquare) + $this->options->drawCircularModules && $this->matrix->checkTypeNotIn($x, $y, $this->options->keepAsSquare) ? $this->imagickDraw->circle( ($x + 0.5) * $this->scale, ($y + 0.5) * $this->scale, diff --git a/src/Output/QRMarkup.php b/src/Output/QRMarkup.php index 004adcf8c..027281617 100644 --- a/src/Output/QRMarkup.php +++ b/src/Output/QRMarkup.php @@ -188,7 +188,7 @@ class QRMarkup extends QROutputAbstract{ return ''; } - if($this->options->drawCircularModules && !$this->matrix->checkTypes($x, $y, $this->options->keepAsSquare)){ + if($this->options->drawCircularModules && $this->matrix->checkTypeNotIn($x, $y, $this->options->keepAsSquare)){ $r = $this->options->circleRadius; return sprintf( diff --git a/src/Output/QROutputAbstract.php b/src/Output/QROutputAbstract.php index f1d2d5004..37d77510d 100644 --- a/src/Output/QROutputAbstract.php +++ b/src/Output/QROutputAbstract.php @@ -142,7 +142,7 @@ abstract class QROutputAbstract implements QROutputInterface{ foreach($this->matrix->matrix() as $y => $row){ foreach($row as $x => $M_TYPE){ - if($this->options->connectPaths && !$this->matrix->checkTypes($x, $y, $this->options->excludeFromConnect)){ + if($this->options->connectPaths && $this->matrix->checkTypeNotIn($x, $y, $this->options->excludeFromConnect)){ // to connect paths we'll redeclare the $M_TYPE to data only $M_TYPE = QRMatrix::M_DATA;