Skip to content

Commit e5e9009

Browse files
committed
🚿
1 parent ad1e39a commit e5e9009

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

examples/imageWithText.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ protected function addText(string $text):void{
7373

7474
// copy over the qrcode
7575
imagecopymerge($this->image, $qrcode, 0, 0, 0, 0, $this->length, $this->length, 100);
76-
imagedestroy($qrcode);
7776

7877
$fontColor = imagecolorallocate($this->image, ...$textColor);
7978
$w = imagefontwidth($textSize);

examples/svgMeltedModules.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected function collectModules():array{
5959
// collect the modules per $M_TYPE
6060
$module = $this->moduleTransform($x, $y, $M_TYPE, $M_TYPE_LAYER);
6161

62-
if(!empty($module)){
62+
if($module !== null){
6363
$paths[$M_TYPE_LAYER][] = $module;
6464
}
6565
}

examples/svgModuleGroupShape.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected function collectModules():array{
5656
// collect the modules per $M_TYPE
5757
$module = $this->moduleTransform($x, $y, $M_TYPE, $M_TYPE_LAYER);
5858

59-
if(!empty($module)){
59+
if($module !== null){
6060
$paths[$M_TYPE_LAYER][] = $module;
6161
}
6262
}
@@ -68,14 +68,18 @@ protected function collectModules():array{
6868
return $paths;
6969
}
7070

71-
protected function moduleTransform(int $x, int $y, int $M_TYPE, int $M_TYPE_LAYER):string{
71+
protected function moduleTransform(int $x, int $y, int $M_TYPE, int $M_TYPE_LAYER):string|null{
7272
$bits = $this->matrix->checkNeighbours($x, $y, null);
7373
$check = fn(int $all, int $any = 0):bool => ($bits & ($all | (~$any & 0xff))) === $all;
7474

7575
$template = ($M_TYPE & QRMatrix::IS_DARK) === QRMatrix::IS_DARK
7676
? $this->darkModule($check, $this->options->inverseMelt)
7777
: $this->lightModule($check, $this->options->inverseMelt);
7878

79+
if($template === ''){
80+
return null;
81+
}
82+
7983
$r = $this->options->meltRadius;
8084

8185
return sprintf($template, $x, $y, $r, (1 - $r), (1 - 2 * $r));

examples/svgRandomColoredDots.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected function collectModules():array{
6565
// collect the modules per $M_TYPE
6666
$module = $this->moduleTransform($x, $y, $M_TYPE, $M_TYPE_LAYER);
6767

68-
if(!empty($module)){
68+
if($module !== null){
6969
$paths[$M_TYPE_LAYER][] = $module;
7070
}
7171
}

examples/svgRoundQuietzone.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function createMarkup(bool $saveToFile):string{
5353
// start SVG output
5454
$svg = $this->header();
5555

56-
if(!empty($this->options->svgDefs)){
56+
if($this->options->svgDefs !== ''){
5757
$svg .= sprintf('<defs>%1$s%2$s</defs>%2$s', $this->options->svgDefs, $this->options->eol);
5858
}
5959

@@ -186,7 +186,7 @@ protected function collectModules():array{
186186
// collect the modules per $M_TYPE
187187
$module = $this->moduleTransform($x, $y, $M_TYPE, $M_TYPE_LAYER);
188188

189-
if(!empty($module)){
189+
if($module !== null){
190190
$paths[$M_TYPE_LAYER][] = $module;
191191
}
192192
}

0 commit comments

Comments
 (0)