mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-26 15:48:11 +00:00
🚿 rename QRMatrix::checkTypes() to checkTypeNotIn() and switch return value to better reflect what it actually does
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user