smiley пре 1 месец
родитељ
комит
7448525638
3 измењених фајлова са 18 додато и 6 уклоњено
  1. 7 2
      docs/Customizing/QROutputAbstract.md
  2. 6 0
      docs/Usage/Advanced-usage.md
  3. 5 4
      docs/Usage/Installation.md

+ 7 - 2
docs/Customizing/QROutputAbstract.md

@@ -197,7 +197,8 @@ class MyOutput extends QROutputAbstract{
 ### `collectModules()`
 ### `collectModules()`
 
 
 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.
 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.
-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`.
+This method calls a method `moduleTransform()` internally with 4 parameters: the module coordinates `$x` and `$y`, the `$M_TYPE` and `$M_TYPE_LAYER`.
+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.
 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`.
 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`.
 
 
 ```php
 ```php
@@ -206,7 +207,7 @@ class MyOutput extends QROutputAbstract{
 	public function dump(string $file = null):string{
 	public function dump(string $file = null):string{
 
 
 		// collect the modules for the path elements
 		// collect the modules for the path elements
-		$paths = $this->collectModules(fn(int $x, int $y, int $M_TYPE):string => sprintf('%d %d %012b', $x, $y, $M_TYPE));
+		$paths = $this->collectModules();
 
 
 		// loop over the paths
 		// loop over the paths
 		foreach($paths as $M_TYPE_LAYER => &$path){
 		foreach($paths as $M_TYPE_LAYER => &$path){
@@ -221,6 +222,10 @@ class MyOutput extends QROutputAbstract{
 		return implode($this->options->eol, $paths);
 		return implode($this->options->eol, $paths);
 	}
 	}
 
 
+	protected function moduleTransform(int $x, int $y, int $M_TYPE, int $M_TYPE_LAYER):string{
+		return sprintf('%d %d %012b', $x, $y, $M_TYPE);
+	}
+
 }
 }
 ```
 ```
 
 

+ 6 - 0
docs/Usage/Advanced-usage.md

@@ -38,6 +38,12 @@ You can also set an `iterable` of options on an existing QROptions instance:
 $options->fromIterable($myOptions);
 $options->fromIterable($myOptions);
 ```
 ```
 
 
+In addition to that, you can also supply the `iterable` of option values directly to the `QRCode` constructor (v6+):
+
+```php
+$qrCode = new QRCode($myOptions);
+```
+
 
 
 ### Load and save options from/to JSON
 ### Load and save options from/to JSON
 
 

+ 5 - 4
docs/Usage/Installation.md

@@ -12,7 +12,7 @@ Installation via [`composer.json`](https://getcomposer.org/doc/04-schema.md):
 ```json
 ```json
 {
 {
 	"require": {
 	"require": {
-		"php": "^7.4",
+		"php": "^8.2",
 		"chillerlan/php-qrcode": "dev-main"
 		"chillerlan/php-qrcode": "dev-main"
 	}
 	}
 }
 }
@@ -63,7 +63,7 @@ After that, run `composer install` in the package root directory to install the
 Profit!
 Profit!
 
 
 
 
-### Can i use this library without using composer?
+### Can I use this library without using composer?
 
 
 You can, but it's absolutely not recommended, nor supported.
 You can, but it's absolutely not recommended, nor supported.
 
 
@@ -82,8 +82,9 @@ The PHP built-in extensions [GdImage](https://www.php.net/manual/book.image.php)
 
 
 | version | branch/tag                                                           | PHP              | supported | required extensions | optional extensions                                                                | info                      |
 | version | branch/tag                                                           | PHP              | supported | required extensions | optional extensions                                                                | info                      |
 |---------|----------------------------------------------------------------------|------------------|-----------|---------------------|------------------------------------------------------------------------------------|---------------------------|
 |---------|----------------------------------------------------------------------|------------------|-----------|---------------------|------------------------------------------------------------------------------------|---------------------------|
-| **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` |                           |
-| **v4**  | [`4.3.4`](https://github.com/chillerlan/php-qrcode/tree/v4.3.x)      | `^7.4 \|\| ^8.0` | yes       | `gd`, `mbstring`    | `imagick`                                                                          |                           |
+| **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` |                           |
+| **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` |                           |
+| **v4**  | [`4.3.4`](https://github.com/chillerlan/php-qrcode/tree/v4.3.x)      | `^7.4 \|\| ^8.0` | no        | `gd`, `mbstring`    | `imagick`                                                                          |                           |
 | **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 |
 | **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 |
 | **v2**  | [`2.0.8`](https://github.com/chillerlan/php-qrcode/tree/v2.0.x)      | `>=7.0.3`        | no        | `gd`, `mbstring`    |                                                                                    |                           |
 | **v2**  | [`2.0.8`](https://github.com/chillerlan/php-qrcode/tree/v2.0.x)      | `>=7.0.3`        | no        | `gd`, `mbstring`    |                                                                                    |                           |
 | **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!     |
 | **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!     |