You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Customizing/QROutputAbstract.md
+7-2Lines changed: 7 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -197,7 +197,8 @@ class MyOutput extends QROutputAbstract{
197
197
### `collectModules()`
198
198
199
199
The module collector is particularly useful for plain text based file formats, for example the various markup languages like SVG and HTML or other structured file formats such as EPS.
200
-
This method takes a `Closure` as a parameter, which is called with 4 parameters: the module coordinates `$x` and `$y`, the `$M_TYPE` and `$M_TYPE_LAYER`.
200
+
This method calls a method `moduleTransform()` internally with 4 parameters: the module coordinates `$x` and `$y`, the `$M_TYPE` and `$M_TYPE_LAYER`.
201
+
The transform method should return a value that is valid for a single module of the QR matrix, or `null` if no transform was performed for the current module.
201
202
The `$M_TYPE_LAYER` is a copy of the `$M_TYPE` that represents the array key of the returned array and that may have been reassigned in the collector to another path layer, e.g. through `QROptions::$connectPaths`.
202
203
203
204
```php
@@ -206,7 +207,7 @@ class MyOutput extends QROutputAbstract{
206
207
public function dump(string $file = null):string{
207
208
208
209
// collect the modules for the path elements
209
-
$paths = $this->collectModules(fn(int $x, int $y, int $M_TYPE):string => sprintf('%d %d %012b', $x, $y, $M_TYPE));
210
+
$paths = $this->collectModules();
210
211
211
212
// loop over the paths
212
213
foreach($paths as $M_TYPE_LAYER => &$path){
@@ -221,6 +222,10 @@ class MyOutput extends QROutputAbstract{
221
222
return implode($this->options->eol, $paths);
222
223
}
223
224
225
+
protected function moduleTransform(int $x, int $y, int $M_TYPE, int $M_TYPE_LAYER):string{
|**v5**|[`dev-main`](https://github.com/chillerlan/php-qrcode/tree/main)|`^7.4 \|\| ^8.0`| yes |`mbstring`|`gd` or `imagick` required for reading QR Codes, `fileinfo` is used in `QRImagick`||
|**v6**|[`dev-main`](https://github.com/chillerlan/php-qrcode/tree/main)|`^8.2`| yes |`mbstring`|`gd` or `imagick` required for reading QR Codes, `fileinfo` is used in `QRImagick`||
86
+
|**v5**|[`5.0.5`](https://github.com/chillerlan/php-qrcode/tree/v5.0.x)|`^7.4 \|\| ^8.0`| yes |`mbstring`|`gd` or `imagick` required for reading QR Codes, `fileinfo` is used in `QRImagick`||
87
+
|**v4**|[`4.3.4`](https://github.com/chillerlan/php-qrcode/tree/v4.3.x)|`^7.4 \|\| ^8.0`| no |`gd`, `mbstring`|`imagick`||
87
88
|**v3**|[`3.4.1`](https://github.com/chillerlan/php-qrcode/tree/v3.2.x)|`^7.2`| no |`gd`, `mbstring`|`imagick`| v3.4.1 also supports PHP8 |
88
89
|**v2**|[`2.0.8`](https://github.com/chillerlan/php-qrcode/tree/v2.0.x)|`>=7.0.3`| no |`gd`, `mbstring`|||
89
90
|**v1**|[`1.0.9`](https://github.com/chillerlan/php-qrcode/tree/v2.0.x-php5)|`>=5.6`| no |`gd`, `mbstring`|| please let PHP 5 die! |
0 commit comments