diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 81ba436..cabc576 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,4 +1,4 @@
-> **Note:** Please fill out all required sections and remove irrelevant ones.
+> **Note:** Please fill out all relevant sections and remove irrelevant ones.
### 🔀 Purpose of this PR:
- [ ] Fixes a bug
diff --git a/thirdparty/composer.json b/thirdparty/composer.json
index 3a2869f..35d59d9 100644
--- a/thirdparty/composer.json
+++ b/thirdparty/composer.json
@@ -1,5 +1,5 @@
{
"require": {
- "endroid/qr-code": "4.6.1"
+ "endroid/qr-code": "6.0.0"
}
}
diff --git a/thirdparty/composer.lock b/thirdparty/composer.lock
index 85a2fb3..ef13f22 100644
--- a/thirdparty/composer.lock
+++ b/thirdparty/composer.lock
@@ -4,32 +4,32 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "e685e4209c795821adad547a48dad74f",
+ "content-hash": "8e9c49306c7bd99a4ce117795a443cfe",
"packages": [
{
"name": "bacon/bacon-qr-code",
- "version": "2.0.8",
+ "version": "v3.0.1",
"source": {
"type": "git",
"url": "https://github.com/Bacon/BaconQrCode.git",
- "reference": "8674e51bb65af933a5ffaf1c308a660387c35c22"
+ "reference": "f9cc1f52b5a463062251d666761178dbdb6b544f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/8674e51bb65af933a5ffaf1c308a660387c35c22",
- "reference": "8674e51bb65af933a5ffaf1c308a660387c35c22",
+ "url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/f9cc1f52b5a463062251d666761178dbdb6b544f",
+ "reference": "f9cc1f52b5a463062251d666761178dbdb6b544f",
"shasum": ""
},
"require": {
"dasprid/enum": "^1.0.3",
"ext-iconv": "*",
- "php": "^7.1 || ^8.0"
+ "php": "^8.1"
},
"require-dev": {
- "phly/keep-a-changelog": "^2.1",
- "phpunit/phpunit": "^7 | ^8 | ^9",
- "spatie/phpunit-snapshot-assertions": "^4.2.9",
- "squizlabs/php_codesniffer": "^3.4"
+ "phly/keep-a-changelog": "^2.12",
+ "phpunit/phpunit": "^10.5.11 || 11.0.4",
+ "spatie/phpunit-snapshot-assertions": "^5.1.5",
+ "squizlabs/php_codesniffer": "^3.9"
},
"suggest": {
"ext-imagick": "to generate QR code images"
@@ -56,22 +56,22 @@
"homepage": "https://github.com/Bacon/BaconQrCode",
"support": {
"issues": "https://github.com/Bacon/BaconQrCode/issues",
- "source": "https://github.com/Bacon/BaconQrCode/tree/2.0.8"
+ "source": "https://github.com/Bacon/BaconQrCode/tree/v3.0.1"
},
- "time": "2022-12-07T17:46:57+00:00"
+ "time": "2024-10-01T13:55:55+00:00"
},
{
"name": "dasprid/enum",
- "version": "1.0.6",
+ "version": "1.0.7",
"source": {
"type": "git",
"url": "https://github.com/DASPRiD/Enum.git",
- "reference": "8dfd07c6d2cf31c8da90c53b83c026c7696dda90"
+ "reference": "b5874fa9ed0043116c72162ec7f4fb50e02e7cce"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/DASPRiD/Enum/zipball/8dfd07c6d2cf31c8da90c53b83c026c7696dda90",
- "reference": "8dfd07c6d2cf31c8da90c53b83c026c7696dda90",
+ "url": "https://api.github.com/repos/DASPRiD/Enum/zipball/b5874fa9ed0043116c72162ec7f4fb50e02e7cce",
+ "reference": "b5874fa9ed0043116c72162ec7f4fb50e02e7cce",
"shasum": ""
},
"require": {
@@ -106,32 +106,32 @@
],
"support": {
"issues": "https://github.com/DASPRiD/Enum/issues",
- "source": "https://github.com/DASPRiD/Enum/tree/1.0.6"
+ "source": "https://github.com/DASPRiD/Enum/tree/1.0.7"
},
- "time": "2024-08-09T14:30:48+00:00"
+ "time": "2025-09-16T12:23:56+00:00"
},
{
"name": "endroid/qr-code",
- "version": "4.6.1",
+ "version": "6.0.0",
"source": {
"type": "git",
"url": "https://github.com/endroid/qr-code.git",
- "reference": "a75c913b0e4d6ad275e49a2c1de1cacffc6c2184"
+ "reference": "61cc3ef6863936b58e0cbe63a44da79efe3c84cd"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/endroid/qr-code/zipball/a75c913b0e4d6ad275e49a2c1de1cacffc6c2184",
- "reference": "a75c913b0e4d6ad275e49a2c1de1cacffc6c2184",
+ "url": "https://api.github.com/repos/endroid/qr-code/zipball/61cc3ef6863936b58e0cbe63a44da79efe3c84cd",
+ "reference": "61cc3ef6863936b58e0cbe63a44da79efe3c84cd",
"shasum": ""
},
"require": {
- "bacon/bacon-qr-code": "^2.0.5",
- "php": "^7.4||^8.0"
+ "bacon/bacon-qr-code": "^3.0",
+ "php": "^8.2"
},
"require-dev": {
- "endroid/quality": "dev-master",
+ "endroid/quality": "dev-main",
"ext-gd": "*",
- "khanamiryan/qrcode-detector-decoder": "^1.0.4",
+ "khanamiryan/qrcode-detector-decoder": "^2.0.2",
"setasign/fpdf": "^1.8.2"
},
"suggest": {
@@ -143,7 +143,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "4.x-dev"
+ "dev-main": "6.x-dev"
}
},
"autoload": {
@@ -172,7 +172,7 @@
],
"support": {
"issues": "https://github.com/endroid/qr-code/issues",
- "source": "https://github.com/endroid/qr-code/tree/4.6.1"
+ "source": "https://github.com/endroid/qr-code/tree/6.0.0"
},
"funding": [
{
@@ -180,16 +180,16 @@
"type": "github"
}
],
- "time": "2022-10-26T08:48:17+00:00"
+ "time": "2024-10-21T20:26:43+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
- "stability-flags": {},
+ "stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
- "platform": {},
- "platform-dev": {},
+ "platform": [],
+ "platform-dev": [],
"plugin-api-version": "2.6.0"
}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/README.md b/thirdparty/vendor/bacon/bacon-qr-code/README.md
index 9c099fe..e429889 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/README.md
+++ b/thirdparty/vendor/bacon/bacon-qr-code/README.md
@@ -37,3 +37,21 @@ BaconQrCode comes with multiple back ends for rendering images. Currently includ
- `ImagickImageBackEnd`: renders raster images using the Imagick library
- `SvgImageBackEnd`: renders SVG files using XMLWriter
- `EpsImageBackEnd`: renders EPS files
+
+### GDLib Renderer
+GD library has so many limitations, that GD support is not added as backend, but as separated renderer.
+Use `GDLibRenderer` instead of `ImageRenderer`. These are the limitations:
+
+- Does not support gradient.
+- Does not support any curves, so you QR code is always squared.
+
+Example usage:
+
+```php
+use BaconQrCode\Renderer\GDLibRenderer;
+use BaconQrCode\Writer;
+
+$renderer = new GDLibRenderer(400);
+$writer = new Writer($renderer);
+$writer->writeFile('Hello World!', 'qrcode.png');
+```
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/composer.json b/thirdparty/vendor/bacon/bacon-qr-code/composer.json
index 7f193da..41f4166 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/composer.json
+++ b/thirdparty/vendor/bacon/bacon-qr-code/composer.json
@@ -1,10 +1,10 @@
{
"name": "bacon/bacon-qr-code",
"description": "BaconQrCode is a QR code generator for PHP.",
- "license" : "BSD-2-Clause",
+ "license": "BSD-2-Clause",
"homepage": "https://github.com/Bacon/BaconQrCode",
"require": {
- "php": "^7.1 || ^8.0",
+ "php": "^8.1",
"ext-iconv": "*",
"dasprid/enum": "^1.0.3"
},
@@ -24,15 +24,21 @@
"BaconQrCode\\": "src/"
}
},
+ "autoload-dev": {
+ "psr-4": {
+ "BaconQrCodeTest\\": "test/"
+ }
+ },
"require-dev": {
- "phpunit/phpunit": "^7 | ^8 | ^9",
- "spatie/phpunit-snapshot-assertions": "^4.2.9",
- "squizlabs/php_codesniffer": "^3.4",
- "phly/keep-a-changelog": "^2.1"
+ "phpunit/phpunit": "^10.5.11 || 11.0.4",
+ "spatie/phpunit-snapshot-assertions": "^5.1.5",
+ "squizlabs/php_codesniffer": "^3.9",
+ "phly/keep-a-changelog": "^2.12"
},
"config": {
"allow-plugins": {
- "ocramius/package-versions": true
+ "ocramius/package-versions": true,
+ "php-http/discovery": true
}
},
"archive": {
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/phpunit.xml.dist b/thirdparty/vendor/bacon/bacon-qr-code/phpunit.xml.dist
deleted file mode 100644
index d9e4d57..0000000
--- a/thirdparty/vendor/bacon/bacon-qr-code/phpunit.xml.dist
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
- src
-
-
-
-
- ./test
-
-
-
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Common/BitArray.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Common/BitArray.php
index 158384f..9ec8629 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Common/BitArray.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Common/BitArray.php
@@ -16,21 +16,13 @@ final class BitArray
*
* @var SplFixedArray
*/
- private $bits;
-
- /**
- * Size of the bit array in bits.
- *
- * @var int
- */
- private $size;
+ private SplFixedArray $bits;
/**
* Creates a new bit array with a given size.
*/
- public function __construct(int $size = 0)
+ public function __construct(private int $size = 0)
{
- $this->size = $size;
$this->bits = SplFixedArray::fromArray(array_fill(0, ($this->size + 31) >> 3, 0));
}
@@ -107,7 +99,7 @@ public function getNextSet(int $from) : int
}
$result = ($bitsOffset << 5) + BitUtils::numberOfTrailingZeros($currentBits);
- return $result > $this->size ? $this->size : $result;
+ return min($result, $this->size);
}
/**
@@ -133,7 +125,7 @@ public function getNextUnset(int $from) : int
}
$result = ($bitsOffset << 5) + BitUtils::numberOfTrailingZeros($currentBits);
- return $result > $this->size ? $this->size : $result;
+ return min($result, $this->size);
}
/**
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Common/BitMatrix.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Common/BitMatrix.php
index 10bf8fe..294afb4 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Common/BitMatrix.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Common/BitMatrix.php
@@ -17,36 +17,30 @@ class BitMatrix
{
/**
* Width of the bit matrix.
- *
- * @var int
*/
- private $width;
+ private int $width;
/**
* Height of the bit matrix.
- *
- * @var int
*/
- private $height;
+ private ?int $height;
/**
* Size in bits of each individual row.
- *
- * @var int
*/
- private $rowSize;
+ private int $rowSize;
/**
* Bits representation.
*
* @var SplFixedArray
*/
- private $bits;
+ private SplFixedArray $bits;
/**
* @throws InvalidArgumentException if a dimension is smaller than zero
*/
- public function __construct(int $width, int $height = null)
+ public function __construct(int $width, ?int $height = null)
{
if (null === $height) {
$height = $width;
@@ -138,7 +132,7 @@ public function setRegion(int $left, int $top, int $width, int $height) : void
/**
* A fast method to retrieve one row of data from the matrix as a BitArray.
*/
- public function getRow(int $y, BitArray $row = null) : BitArray
+ public function getRow(int $y, ?BitArray $row = null) : BitArray
{
if (null === $row || $row->getSize() < $this->width) {
$row = new BitArray($this->width);
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Common/CharacterSetEci.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Common/CharacterSetEci.php
index 9049ccb..8b62b8c 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Common/CharacterSetEci.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Common/CharacterSetEci.php
@@ -69,32 +69,26 @@ final class CharacterSetEci extends AbstractEnum
protected const GB18030 = [[29], 'GB2312', 'EUC_CN', 'GBK'];
protected const EUC_KR = [[30], 'EUC-KR'];
- /**
- * @var int[]
- */
- private $values;
-
/**
* @var string[]
*/
- private $otherEncodingNames;
+ private array $otherEncodingNames;
/**
* @var array|null
*/
- private static $valueToEci;
+ private static ?array $valueToEci;
/**
* @var array|null
*/
- private static $nameToEci;
+ private static ?array $nameToEci = null;
/**
* @param int[] $values
*/
- public function __construct(array $values, string ...$otherEncodingNames)
+ public function __construct(private readonly array $values, string ...$otherEncodingNames)
{
- $this->values = $values;
$this->otherEncodingNames = $otherEncodingNames;
}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Common/EcBlock.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Common/EcBlock.php
index a9a1d07..bc9e865 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Common/EcBlock.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Common/EcBlock.php
@@ -11,24 +11,8 @@
*/
final class EcBlock
{
- /**
- * How many times the block is used.
- *
- * @var int
- */
- private $count;
-
- /**
- * Number of data codewords.
- *
- * @var int
- */
- private $dataCodewords;
-
- public function __construct(int $count, int $dataCodewords)
+ public function __construct(private readonly int $count, private readonly int $dataCodewords)
{
- $this->count = $count;
- $this->dataCodewords = $dataCodewords;
}
/**
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Common/EcBlocks.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Common/EcBlocks.php
index 172b5f2..63c52a9 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Common/EcBlocks.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Common/EcBlocks.php
@@ -12,23 +12,15 @@
*/
final class EcBlocks
{
- /**
- * Number of EC codewords per block.
- *
- * @var int
- */
- private $ecCodewordsPerBlock;
-
/**
* List of EC blocks.
*
* @var EcBlock[]
*/
- private $ecBlocks;
+ private array $ecBlocks;
- public function __construct(int $ecCodewordsPerBlock, EcBlock ...$ecBlocks)
+ public function __construct(private readonly int $ecCodewordsPerBlock, EcBlock ...$ecBlocks)
{
- $this->ecCodewordsPerBlock = $ecCodewordsPerBlock;
$this->ecBlocks = $ecBlocks;
}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Common/ErrorCorrectionLevel.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Common/ErrorCorrectionLevel.php
index 9bbf440..ac84d66 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Common/ErrorCorrectionLevel.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Common/ErrorCorrectionLevel.php
@@ -21,14 +21,8 @@ final class ErrorCorrectionLevel extends AbstractEnum
protected const Q = [0x03];
protected const H = [0x02];
- /**
- * @var int
- */
- private $bits;
-
- protected function __construct(int $bits)
+ protected function __construct(private readonly int $bits)
{
- $this->bits = $bits;
}
/**
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Common/FormatInformation.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Common/FormatInformation.php
index 38295fc..6a5da0b 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Common/FormatInformation.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Common/FormatInformation.php
@@ -68,17 +68,10 @@ class FormatInformation
/**
* Error correction level.
- *
- * @var ErrorCorrectionLevel
*/
- private $ecLevel;
+ private ErrorCorrectionLevel $ecLevel;
- /**
- * Data mask.
- *
- * @var int
- */
- private $dataMask;
+ private int $dataMask;
protected function __construct(int $formatInfo)
{
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Common/Mode.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Common/Mode.php
index af5a113..f5fb153 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Common/Mode.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Common/Mode.php
@@ -32,23 +32,13 @@ final class Mode extends AbstractEnum
protected const FNC1_SECOND_POSITION = [[0, 0, 0], 0x09];
protected const HANZI = [[8, 10, 12], 0x0d];
- /**
- * @var int[]
- */
- private $characterCountBitsForVersions;
-
- /**
- * @var int
- */
- private $bits;
-
/**
* @param int[] $characterCountBitsForVersions
*/
- protected function __construct(array $characterCountBitsForVersions, int $bits)
- {
- $this->characterCountBitsForVersions = $characterCountBitsForVersions;
- $this->bits = $bits;
+ protected function __construct(
+ private readonly array $characterCountBitsForVersions,
+ private readonly int $bits
+ ) {
}
/**
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Common/ReedSolomonCodec.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Common/ReedSolomonCodec.php
index a5aad0b..d16a75e 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Common/ReedSolomonCodec.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Common/ReedSolomonCodec.php
@@ -16,73 +16,59 @@ final class ReedSolomonCodec
{
/**
* Symbol size in bits.
- *
- * @var int
*/
- private $symbolSize;
+ private int $symbolSize;
/**
* Block size in symbols.
- *
- * @var int
*/
- private $blockSize;
+ private int $blockSize;
/**
* First root of RS code generator polynomial, index form.
- *
- * @var int
*/
- private $firstRoot;
+ private int $firstRoot;
/**
* Primitive element to generate polynomial roots, index form.
- *
- * @var int
*/
- private $primitive;
+ private int $primitive;
/**
* Prim-th root of 1, index form.
- *
- * @var int
*/
- private $iPrimitive;
+ private int $iPrimitive;
/**
* RS code generator polynomial degree (number of roots).
- *
- * @var int
*/
- private $numRoots;
+ private int $numRoots;
/**
* Padding bytes at front of shortened block.
- *
- * @var int
*/
- private $padding;
+ private int $padding;
/**
* Log lookup table.
*
* @var SplFixedArray
*/
- private $alphaTo;
+ private SplFixedArray $alphaTo;
/**
* Anti-Log lookup table.
*
* @var SplFixedArray
*/
- private $indexOf;
+ private SplFixedArray $indexOf;
/**
* Generator polynomial.
*
* @var SplFixedArray
*/
- private $generatorPoly;
+ private SplFixedArray $generatorPoly;
/**
* @throws InvalidArgumentException if symbol size ist not between 0 and 8
@@ -222,7 +208,7 @@ public function encode(SplFixedArray $data, SplFixedArray $parity) : void
/**
* Decodes received data.
*/
- public function decode(SplFixedArray $data, SplFixedArray $erasures = null) : ?int
+ public function decode(SplFixedArray $data, ?SplFixedArray $erasures = null) : ?int
{
// This speeds up the initialization a bit.
$numRootsPlusOne = SplFixedArray::fromArray(array_fill(0, $this->numRoots + 1, 0), false);
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Common/Version.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Common/Version.php
index 917d048..68d3d16 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Common/Version.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Common/Version.php
@@ -50,38 +50,34 @@ final class Version
/**
* Version number of this version.
- *
- * @var int
*/
- private $versionNumber;
+ private int $versionNumber;
/**
* Alignment pattern centers.
*
- * @var SplFixedArray
+ * @var SplFixedArray|array
*/
- private $alignmentPatternCenters;
+ private SplFixedArray|array $alignmentPatternCenters;
/**
* Error correction blocks.
*
* @var EcBlocks[]
*/
- private $ecBlocks;
+ private array $ecBlocks;
/**
* Total number of codewords.
- *
- * @var int
*/
- private $totalCodewords;
+ private null|int|float $totalCodewords;
/**
* Cached version instances.
*
* @var array|null
*/
- private static $versions;
+ private static ?array $versions = null;
/**
* @param int[] $alignmentPatternCenters
@@ -300,7 +296,7 @@ private static function versions() : array
[6, 26],
new EcBlocks(20, new EcBlock(1, 80)),
new EcBlocks(18, new EcBlock(2, 32)),
- new EcBlocks(26, new EcBlock(3, 24)),
+ new EcBlocks(26, new EcBlock(2, 24)),
new EcBlocks(16, new EcBlock(4, 9))
),
new self(
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Encoder/BlockPair.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Encoder/BlockPair.php
index be54afa..b1dc5c4 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Encoder/BlockPair.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Encoder/BlockPair.php
@@ -10,30 +10,16 @@
*/
final class BlockPair
{
- /**
- * Data bytes in the block.
- *
- * @var SplFixedArray
- */
- private $dataBytes;
-
- /**
- * Error correction bytes in the block.
- *
- * @var SplFixedArray
- */
- private $errorCorrectionBytes;
-
/**
* Creates a new block pair.
*
- * @param SplFixedArray $data
- * @param SplFixedArray $errorCorrection
+ * @param SplFixedArray $dataBytes Data bytes in the block.
+ * @param SplFixedArray $errorCorrectionBytes Error correction bytes in the block.
*/
- public function __construct(SplFixedArray $data, SplFixedArray $errorCorrection)
- {
- $this->dataBytes = $data;
- $this->errorCorrectionBytes = $errorCorrection;
+ public function __construct(
+ private readonly SplFixedArray $dataBytes,
+ private readonly SplFixedArray $errorCorrectionBytes
+ ) {
}
/**
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Encoder/ByteMatrix.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Encoder/ByteMatrix.php
index b58cc0a..eefcf1c 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Encoder/ByteMatrix.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Encoder/ByteMatrix.php
@@ -16,26 +16,10 @@ final class ByteMatrix
*
* @var SplFixedArray>
*/
- private $bytes;
+ private SplFixedArray $bytes;
- /**
- * Width of the matrix.
- *
- * @var int
- */
- private $width;
-
- /**
- * Height of the matrix.
- *
- * @var int
- */
- private $height;
-
- public function __construct(int $width, int $height)
+ public function __construct(private readonly int $width, private readonly int $height)
{
- $this->height = $height;
- $this->width = $width;
$this->bytes = new SplFixedArray($height);
for ($y = 0; $y < $height; ++$y) {
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Encoder/Encoder.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Encoder/Encoder.php
index 3208460..c363953 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Encoder/Encoder.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Encoder/Encoder.php
@@ -20,7 +20,10 @@ final class Encoder
/**
* Default byte encoding.
*/
- public const DEFAULT_BYTE_MODE_ECODING = 'ISO-8859-1';
+ public const DEFAULT_BYTE_MODE_ENCODING = 'ISO-8859-1';
+
+ /** @deprecated use DEFAULT_BYTE_MODE_ENCODING */
+ public const DEFAULT_BYTE_MODE_ECODING = self::DEFAULT_BYTE_MODE_ENCODING;
/**
* The original table is defined in the table 5 of JISX0510:2004 (p.19).
@@ -39,7 +42,7 @@ final class Encoder
*
* @var array
*/
- private static $codecs = [];
+ private static array $codecs = [];
/**
* Encodes "content" with the error correction level "ecLevel".
@@ -47,8 +50,10 @@ final class Encoder
public static function encode(
string $content,
ErrorCorrectionLevel $ecLevel,
- string $encoding = self::DEFAULT_BYTE_MODE_ECODING,
- ?Version $forcedVersion = null
+ string $encoding = self::DEFAULT_BYTE_MODE_ENCODING,
+ ?Version $forcedVersion = null,
+ // Barcode scanner might not be able to read the encoded message of the QR code with the prefix ECI of UTF-8
+ bool $prefixEci = true
) : QrCode {
// Pick an encoding mode appropriate for the content. Note that this
// will not attempt to use multiple modes / segments even if that were
@@ -60,7 +65,7 @@ public static function encode(
$headerBits = new BitArray();
// Append ECI segment if applicable
- if (Mode::BYTE() === $mode && self::DEFAULT_BYTE_MODE_ECODING !== $encoding) {
+ if ($prefixEci && Mode::BYTE() === $mode && self::DEFAULT_BYTE_MODE_ENCODING !== $encoding) {
$eci = CharacterSetEci::getCharacterSetEciByName($encoding);
if (null !== $eci) {
@@ -155,7 +160,7 @@ private static function getAlphanumericCode(int $code) : int
/**
* Chooses the best mode for a given content.
*/
- private static function chooseMode(string $content, string $encoding = null) : Mode
+ private static function chooseMode(string $content, ?string $encoding = null) : Mode
{
if (null !== $encoding && 0 === strcasecmp($encoding, 'SHIFT-JIS')) {
return self::isOnlyDoubleByteKanji($content) ? Mode::KANJI() : Mode::BYTE();
@@ -217,7 +222,7 @@ private static function isOnlyDoubleByteKanji(string $content) : bool
}
for ($i = 0; $i < $length; $i += 2) {
- $byte = $bytes[$i] & 0xff;
+ $byte = ord($bytes[$i]) & 0xff;
if (($byte < 0x81 || $byte > 0x9f) && $byte < 0xe0 || $byte > 0xeb) {
return false;
@@ -629,17 +634,23 @@ private static function append8BitBytes(string $content, BitArray $bits, string
*/
private static function appendKanjiBytes(string $content, BitArray $bits) : void
{
- if (strlen($content) % 2 > 0) {
+ $bytes = @iconv('utf-8', 'SHIFT-JIS', $content);
+
+ if (false === $bytes) {
+ throw new WriterException('Content could not be converted to SHIFT-JIS');
+ }
+
+ if (strlen($bytes) % 2 > 0) {
// We just do a simple length check here. The for loop will check
// individual characters.
throw new WriterException('Content does not seem to be encoded in SHIFT-JIS');
}
- $length = strlen($content);
+ $length = strlen($bytes);
for ($i = 0; $i < $length; $i += 2) {
- $byte1 = ord($content[$i]) & 0xff;
- $byte2 = ord($content[$i + 1]) & 0xff;
+ $byte1 = ord($bytes[$i]) & 0xff;
+ $byte2 = ord($bytes[$i + 1]) & 0xff;
$code = ($byte1 << 8) | $byte2;
if ($code >= 0x8140 && $code <= 0x9ffc) {
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Encoder/MaskUtil.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Encoder/MaskUtil.php
index ba97dfb..54a07ba 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Encoder/MaskUtil.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Encoder/MaskUtil.php
@@ -14,10 +14,10 @@ final class MaskUtil
/**#@+
* Penalty weights from section 6.8.2.1
*/
- const N1 = 3;
- const N2 = 3;
- const N3 = 40;
- const N4 = 10;
+ public const N1 = 3;
+ public const N2 = 3;
+ public const N3 = 40;
+ public const N4 = 10;
/**#@-*/
private function __construct()
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Encoder/QrCode.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Encoder/QrCode.php
index f568e88..c3398f4 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Encoder/QrCode.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Encoder/QrCode.php
@@ -17,51 +17,23 @@ final class QrCode
*/
public const NUM_MASK_PATTERNS = 8;
- /**
- * Mode of the QR code.
- *
- * @var Mode
- */
- private $mode;
-
- /**
- * EC level of the QR code.
- *
- * @var ErrorCorrectionLevel
- */
- private $errorCorrectionLevel;
-
- /**
- * Version of the QR code.
- *
- * @var Version
- */
- private $version;
-
/**
* Mask pattern of the QR code.
- *
- * @var int
*/
- private $maskPattern = -1;
+ private int $maskPattern = -1;
/**
* Matrix of the QR code.
- *
- * @var ByteMatrix
*/
- private $matrix;
+ private ByteMatrix $matrix;
public function __construct(
- Mode $mode,
- ErrorCorrectionLevel $errorCorrectionLevel,
- Version $version,
- int $maskPattern,
- ByteMatrix $matrix
+ private readonly Mode $mode,
+ private readonly ErrorCorrectionLevel $errorCorrectionLevel,
+ private readonly Version $version,
+ int $maskPattern,
+ ByteMatrix $matrix
) {
- $this->mode = $mode;
- $this->errorCorrectionLevel = $errorCorrectionLevel;
- $this->version = $version;
$this->maskPattern = $maskPattern;
$this->matrix = $matrix;
}
@@ -98,12 +70,7 @@ public function getMaskPattern() : int
return $this->maskPattern;
}
- /**
- * Gets the matrix.
- *
- * @return ByteMatrix
- */
- public function getMatrix()
+ public function getMatrix(): ByteMatrix
{
return $this->matrix;
}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Color/Alpha.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Color/Alpha.php
index 3490252..067a554 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Color/Alpha.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Color/Alpha.php
@@ -7,27 +7,14 @@
final class Alpha implements ColorInterface
{
- /**
- * @var int
- */
- private $alpha;
-
- /**
- * @var ColorInterface
- */
- private $baseColor;
-
/**
* @param int $alpha the alpha value, 0 to 100
*/
- public function __construct(int $alpha, ColorInterface $baseColor)
+ public function __construct(private readonly int $alpha, private readonly ColorInterface $baseColor)
{
if ($alpha < 0 || $alpha > 100) {
throw new Exception\InvalidArgumentException('Alpha must be between 0 and 100');
}
-
- $this->alpha = $alpha;
- $this->baseColor = $baseColor;
}
public function getAlpha() : int
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Color/Cmyk.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Color/Cmyk.php
index d6de390..d028210 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Color/Cmyk.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Color/Cmyk.php
@@ -7,34 +7,18 @@
final class Cmyk implements ColorInterface
{
- /**
- * @var int
- */
- private $cyan;
-
- /**
- * @var int
- */
- private $magenta;
-
- /**
- * @var int
- */
- private $yellow;
-
- /**
- * @var int
- */
- private $black;
-
/**
* @param int $cyan the cyan amount, 0 to 100
* @param int $magenta the magenta amount, 0 to 100
* @param int $yellow the yellow amount, 0 to 100
* @param int $black the black amount, 0 to 100
*/
- public function __construct(int $cyan, int $magenta, int $yellow, int $black)
- {
+ public function __construct(
+ private readonly int $cyan,
+ private readonly int $magenta,
+ private readonly int $yellow,
+ private readonly int $black
+ ) {
if ($cyan < 0 || $cyan > 100) {
throw new Exception\InvalidArgumentException('Cyan must be between 0 and 100');
}
@@ -50,11 +34,6 @@ public function __construct(int $cyan, int $magenta, int $yellow, int $black)
if ($black < 0 || $black > 100) {
throw new Exception\InvalidArgumentException('Black must be between 0 and 100');
}
-
- $this->cyan = $cyan;
- $this->magenta = $magenta;
- $this->yellow = $yellow;
- $this->black = $black;
}
public function getCyan() : int
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Color/Gray.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Color/Gray.php
index acb986d..76603e4 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Color/Gray.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Color/Gray.php
@@ -7,21 +7,14 @@
final class Gray implements ColorInterface
{
- /**
- * @var int
- */
- private $gray;
-
/**
* @param int $gray the gray value between 0 (black) and 100 (white)
*/
- public function __construct(int $gray)
+ public function __construct(private readonly int $gray)
{
if ($gray < 0 || $gray > 100) {
throw new Exception\InvalidArgumentException('Gray must be between 0 and 100');
}
-
- $this->gray = (int) $gray;
}
public function getGray() : int
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Color/Rgb.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Color/Rgb.php
index 7935406..9e388da 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Color/Rgb.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Color/Rgb.php
@@ -7,27 +7,12 @@
final class Rgb implements ColorInterface
{
- /**
- * @var int
- */
- private $red;
-
- /**
- * @var int
- */
- private $green;
-
- /**
- * @var int
- */
- private $blue;
-
/**
* @param int $red the red amount of the color, 0 to 255
* @param int $green the green amount of the color, 0 to 255
* @param int $blue the blue amount of the color, 0 to 255
*/
- public function __construct(int $red, int $green, int $blue)
+ public function __construct(private readonly int $red, private readonly int $green, private readonly int $blue)
{
if ($red < 0 || $red > 255) {
throw new Exception\InvalidArgumentException('Red must be between 0 and 255');
@@ -40,10 +25,6 @@ public function __construct(int $red, int $green, int $blue)
if ($blue < 0 || $blue > 255) {
throw new Exception\InvalidArgumentException('Blue must be between 0 and 255');
}
-
- $this->red = $red;
- $this->green = $green;
- $this->blue = $blue;
}
public function getRed() : int
@@ -73,6 +54,10 @@ public function toCmyk() : Cmyk
$y = 1 - ($this->blue / 255);
$k = min($c, $m, $y);
+ if ($k === 0) {
+ return new Cmyk(0, 0, 0, 0);
+ }
+
return new Cmyk(
(int) (100 * ($c - $k) / (1 - $k)),
(int) (100 * ($m - $k) / (1 - $k)),
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Eye/CompositeEye.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Eye/CompositeEye.php
index 0d03125..379e5c7 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Eye/CompositeEye.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Eye/CompositeEye.php
@@ -10,20 +10,8 @@
*/
final class CompositeEye implements EyeInterface
{
- /**
- * @var EyeInterface
- */
- private $externalEye;
-
- /**
- * @var EyeInterface
- */
- private $internalEye;
-
- public function __construct(EyeInterface $externalEye, EyeInterface $internalEye)
+ public function __construct(private readonly EyeInterface $externalEye, private readonly EyeInterface $internalEye)
{
- $this->externalEye = $externalEye;
- $this->internalEye = $internalEye;
}
public function getExternalPath() : Path
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Eye/ModuleEye.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Eye/ModuleEye.php
index 84f7d12..a8a3489 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Eye/ModuleEye.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Eye/ModuleEye.php
@@ -12,14 +12,8 @@
*/
final class ModuleEye implements EyeInterface
{
- /**
- * @var ModuleInterface
- */
- private $module;
-
- public function __construct(ModuleInterface $module)
+ public function __construct(private readonly ModuleInterface $module)
{
- $this->module = $module;
}
public function getExternalPath() : Path
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Eye/PointyEye.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Eye/PointyEye.php
new file mode 100644
index 0000000..39c7d23
--- /dev/null
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Eye/PointyEye.php
@@ -0,0 +1,56 @@
+move(-3.5, 3.5)
+ ->line(-3.5, 0)
+ ->ellipticArc(3.5, 3.5, 0, false, true, 0, -3.5)
+ ->line(3.5, -3.5)
+ ->line(3.5, 3.5)
+ ->close()
+ ->move(2.5, 0)
+ ->ellipticArc(2.5, 2.5, 0, false, true, 0, 2.5)
+ ->ellipticArc(2.5, 2.5, 0, false, true, -2.5, 0)
+ ->ellipticArc(2.5, 2.5, 0, false, true, 0, -2.5)
+ ->ellipticArc(2.5, 2.5, 0, false, true, 2.5, 0)
+ ->close()
+ ;
+ }
+
+ public function getInternalPath() : Path
+ {
+ return (new Path())
+ ->move(1.5, 0)
+ ->ellipticArc(1.5, 1.5, 0., false, true, 0., 1.5)
+ ->ellipticArc(1.5, 1.5, 0., false, true, -1.5, 0.)
+ ->ellipticArc(1.5, 1.5, 0., false, true, 0., -1.5)
+ ->ellipticArc(1.5, 1.5, 0., false, true, 1.5, 0.)
+ ->close()
+ ;
+ }
+}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Eye/SimpleCircleEye.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Eye/SimpleCircleEye.php
index 64d54ee..735d326 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Eye/SimpleCircleEye.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Eye/SimpleCircleEye.php
@@ -10,10 +10,7 @@
*/
final class SimpleCircleEye implements EyeInterface
{
- /**
- * @var self|null
- */
- private static $instance;
+ private static ?SimpleCircleEye $instance = null;
private function __construct()
{
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Eye/SquareEye.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Eye/SquareEye.php
index a3892b4..09bedfe 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Eye/SquareEye.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Eye/SquareEye.php
@@ -10,10 +10,7 @@
*/
final class SquareEye implements EyeInterface
{
- /**
- * @var self|null
- */
- private static $instance;
+ private static ?SquareEye $instance = null;
private function __construct()
{
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/GDLibRenderer.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/GDLibRenderer.php
new file mode 100644
index 0000000..51164b9
--- /dev/null
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/GDLibRenderer.php
@@ -0,0 +1,238 @@
+
+ */
+ private array $colors;
+
+ public function __construct(
+ private int $size,
+ private int $margin = 4,
+ private string $imageFormat = 'png',
+ private int $compressionQuality = 9,
+ private ?Fill $fill = null
+ ) {
+ if (! extension_loaded('gd') || ! function_exists('gd_info')) {
+ throw new RuntimeException('You need to install the GD extension to use this back end');
+ }
+
+ if ($this->fill === null) {
+ $this->fill = Fill::default();
+ }
+ if ($this->fill->hasGradientFill()) {
+ throw new InvalidArgumentException('GDLibRenderer does not support gradients');
+ }
+ }
+
+ /**
+ * @throws InvalidArgumentException if matrix width doesn't match height
+ */
+ public function render(QrCode $qrCode): string
+ {
+ $matrix = $qrCode->getMatrix();
+ $matrixSize = $matrix->getWidth();
+
+ if ($matrixSize !== $matrix->getHeight()) {
+ throw new InvalidArgumentException('Matrix must have the same width and height');
+ }
+
+ MatrixUtil::removePositionDetectionPatterns($matrix);
+ $this->newImage();
+ $this->draw($matrix);
+
+ return $this->renderImage();
+ }
+
+ private function newImage(): void
+ {
+ $img = imagecreatetruecolor($this->size, $this->size);
+ if ($img === false) {
+ throw new RuntimeException('Failed to create image of that size');
+ }
+
+ $this->image = $img;
+ imagealphablending($this->image, false);
+ imagesavealpha($this->image, true);
+
+
+ $bg = $this->getColor($this->fill->getBackgroundColor());
+ imagefilledrectangle($this->image, 0, 0, $this->size, $this->size, $bg);
+ imagealphablending($this->image, true);
+ }
+
+ private function draw(ByteMatrix $matrix): void
+ {
+ $matrixSize = $matrix->getWidth();
+
+ $pointsOnSide = $matrix->getWidth() + $this->margin * 2;
+ $pointInPx = $this->size / $pointsOnSide;
+
+ $this->drawEye(0, 0, $pointInPx, $this->fill->getTopLeftEyeFill());
+ $this->drawEye($matrixSize - 7, 0, $pointInPx, $this->fill->getTopRightEyeFill());
+ $this->drawEye(0, $matrixSize - 7, $pointInPx, $this->fill->getBottomLeftEyeFill());
+
+ $rows = $matrix->getArray()->toArray();
+ $color = $this->getColor($this->fill->getForegroundColor());
+ for ($y = 0; $y < $matrixSize; $y += 1) {
+ for ($x = 0; $x < $matrixSize; $x += 1) {
+ if (! $rows[$y][$x]) {
+ continue;
+ }
+
+ $points = $this->normalizePoints([
+ ($this->margin + $x) * $pointInPx, ($this->margin + $y) * $pointInPx,
+ ($this->margin + $x + 1) * $pointInPx, ($this->margin + $y) * $pointInPx,
+ ($this->margin + $x + 1) * $pointInPx, ($this->margin + $y + 1) * $pointInPx,
+ ($this->margin + $x) * $pointInPx, ($this->margin + $y + 1) * $pointInPx,
+ ]);
+ imagefilledpolygon($this->image, $points, $color);
+ }
+ }
+ }
+
+ private function drawEye(int $xOffset, int $yOffset, float $pointInPx, EyeFill $eyeFill): void
+ {
+ $internalColor = $this->getColor($eyeFill->inheritsInternalColor()
+ ? $this->fill->getForegroundColor()
+ : $eyeFill->getInternalColor());
+
+ $externalColor = $this->getColor($eyeFill->inheritsExternalColor()
+ ? $this->fill->getForegroundColor()
+ : $eyeFill->getExternalColor());
+
+ for ($y = 0; $y < 7; $y += 1) {
+ for ($x = 0; $x < 7; $x += 1) {
+ if ((($y === 1 || $y === 5) && $x > 0 && $x < 6) || (($x === 1 || $x === 5) && $y > 0 && $y < 6)) {
+ continue;
+ }
+
+ $points = $this->normalizePoints([
+ ($this->margin + $x + $xOffset) * $pointInPx, ($this->margin + $y + $yOffset) * $pointInPx,
+ ($this->margin + $x + $xOffset + 1) * $pointInPx, ($this->margin + $y + $yOffset) * $pointInPx,
+ ($this->margin + $x + $xOffset + 1) * $pointInPx, ($this->margin + $y + $yOffset + 1) * $pointInPx,
+ ($this->margin + $x + $xOffset) * $pointInPx, ($this->margin + $y + $yOffset + 1) * $pointInPx,
+ ]);
+
+ if ($y > 1 && $y < 5 && $x > 1 && $x < 5) {
+ imagefilledpolygon($this->image, $points, $internalColor);
+ } else {
+ imagefilledpolygon($this->image, $points, $externalColor);
+ }
+ }
+ }
+ }
+
+ /**
+ * Normalize points will trim right and bottom line by 1 pixel.
+ * Otherwise pixels of neighbors are overlapping which leads to issue with transparency and small QR codes.
+ */
+ private function normalizePoints(array $points): array
+ {
+ $maxX = $maxY = 0;
+ for ($i = 0; $i < count($points); $i += 2) {
+ // Do manual round as GD just removes decimal part
+ $points[$i] = $newX = round($points[$i]);
+ $points[$i + 1] = $newY = round($points[$i + 1]);
+
+ $maxX = max($maxX, $newX);
+ $maxY = max($maxY, $newY);
+ }
+
+ // Do trimming only if there are 4 points (8 coordinates), assumes this is square.
+
+ for ($i = 0; $i < count($points); $i += 2) {
+ $points[$i] = min($points[$i], $maxX - 1);
+ $points[$i + 1] = min($points[$i + 1], $maxY - 1);
+ }
+
+ return $points;
+ }
+
+ private function renderImage(): string
+ {
+ ob_start();
+ $quality = $this->compressionQuality;
+ switch ($this->imageFormat) {
+ case 'png':
+ if ($quality > 9 || $quality < 0) {
+ $quality = 9;
+ }
+ imagepng($this->image, null, $quality);
+ break;
+
+ case 'gif':
+ imagegif($this->image, null);
+ break;
+
+ case 'jpeg':
+ case 'jpg':
+ if ($quality > 100 || $quality < 0) {
+ $quality = 85;
+ }
+ imagejpeg($this->image, null, $quality);
+ break;
+ default:
+ ob_end_clean();
+ throw new InvalidArgumentException(
+ 'Supported image formats are jpeg, png and gif, got: ' . $this->imageFormat
+ );
+ }
+
+ imagedestroy($this->image);
+ $this->colors = [];
+ $this->image = null;
+
+ return ob_get_clean();
+ }
+
+ private function getColor(ColorInterface $color): int
+ {
+ $alpha = 100;
+
+ if ($color instanceof Alpha) {
+ $alpha = $color->getAlpha();
+ $color = $color->getBaseColor();
+ }
+
+ $rgb = $color->toRgb();
+
+ $colorKey = sprintf('%02X%02X%02X%02X', $rgb->getRed(), $rgb->getGreen(), $rgb->getBlue(), $alpha);
+
+ if (! isset($this->colors[$colorKey])) {
+ $colorId = imagecolorallocatealpha(
+ $this->image,
+ $rgb->getRed(),
+ $rgb->getGreen(),
+ $rgb->getBlue(),
+ (int)((100 - $alpha) / 100 * 127) // Alpha for GD is in range 0 (opaque) - 127 (transparent)
+ );
+
+ if ($colorId === false) {
+ throw new RuntimeException('Failed to create color: #' . $colorKey);
+ }
+
+ $this->colors[$colorKey] = $colorId;
+ }
+
+ return $this->colors[$colorKey];
+ }
+}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Image/EpsImageBackEnd.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Image/EpsImageBackEnd.php
index b581b54..4269456 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Image/EpsImageBackEnd.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Image/EpsImageBackEnd.php
@@ -22,10 +22,7 @@ final class EpsImageBackEnd implements ImageBackEndInterface
{
private const PRECISION = 3;
- /**
- * @var string|null
- */
- private $eps;
+ private ?string $eps;
public function new(int $size, ColorInterface $backgroundColor) : void
{
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Image/ImagickImageBackEnd.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Image/ImagickImageBackEnd.php
index adec85e..a16a663 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Image/ImagickImageBackEnd.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Image/ImagickImageBackEnd.php
@@ -23,40 +23,22 @@
final class ImagickImageBackEnd implements ImageBackEndInterface
{
- /**
- * @var string
- */
- private $imageFormat;
+ private string $imageFormat;
- /**
- * @var int
- */
- private $compressionQuality;
+ private int $compressionQuality;
- /**
- * @var Imagick|null
- */
- private $image;
+ private ?Imagick $image;
- /**
- * @var ImagickDraw|null
- */
- private $draw;
+ private ?ImagickDraw $draw;
- /**
- * @var int|null
- */
- private $gradientCount;
+ private ?int $gradientCount;
/**
* @var TransformationMatrix[]|null
*/
- private $matrices;
+ private ?array $matrices;
- /**
- * @var int|null
- */
- private $matrixIndex;
+ private ?int $matrixIndex;
public function __construct(string $imageFormat = 'png', int $compressionQuality = 100)
{
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Image/SvgImageBackEnd.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Image/SvgImageBackEnd.php
index cb37a9f..44d014e 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Image/SvgImageBackEnd.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Image/SvgImageBackEnd.php
@@ -19,26 +19,16 @@
final class SvgImageBackEnd implements ImageBackEndInterface
{
private const PRECISION = 3;
+ private const SCALE_FORMAT = 'scale(%.' . self::PRECISION . 'F)';
+ private const TRANSLATE_FORMAT = 'translate(%.' . self::PRECISION . 'F,%.' . self::PRECISION . 'F)';
- /**
- * @var XMLWriter|null
- */
- private $xmlWriter;
+ private ?XMLWriter $xmlWriter;
- /**
- * @var int[]|null
- */
- private $stack;
+ private ?array $stack;
- /**
- * @var int|null
- */
- private $currentStack;
+ private ?int $currentStack;
- /**
- * @var int|null
- */
- private $gradientCount;
+ private ?int $gradientCount;
public function __construct()
{
@@ -97,7 +87,7 @@ public function scale(float $size) : void
$this->xmlWriter->startElement('g');
$this->xmlWriter->writeAttribute(
'transform',
- sprintf('scale(%s)', round($size, self::PRECISION))
+ sprintf(self::SCALE_FORMAT, round($size, self::PRECISION))
);
++$this->stack[$this->currentStack];
}
@@ -111,7 +101,7 @@ public function translate(float $x, float $y) : void
$this->xmlWriter->startElement('g');
$this->xmlWriter->writeAttribute(
'transform',
- sprintf('translate(%s,%s)', round($x, self::PRECISION), round($y, self::PRECISION))
+ sprintf(self::TRANSLATE_FORMAT, round($x, self::PRECISION), round($y, self::PRECISION))
);
++$this->stack[$this->currentStack];
}
@@ -326,7 +316,11 @@ private function createGradientFill(Gradient $gradient, float $x, float $y, floa
break;
}
- $id = sprintf('g%d', ++$this->gradientCount);
+ $toBeHashed = $this->getColorString($startColor) . $this->getColorString($endColor) . $gradient->getType();
+ if ($startColor instanceof Alpha) {
+ $toBeHashed .= (string) $startColor->getAlpha();
+ }
+ $id = sprintf('g%d-%s', ++$this->gradientCount, hash('xxh64', $toBeHashed));
$this->xmlWriter->writeAttribute('id', $id);
$this->xmlWriter->startElement('stop');
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Image/TransformationMatrix.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Image/TransformationMatrix.php
index 7e88da6..9b435a0 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Image/TransformationMatrix.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Image/TransformationMatrix.php
@@ -8,7 +8,7 @@ final class TransformationMatrix
/**
* @var float[]
*/
- private $values;
+ private array $values;
public function __construct()
{
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/ImageRenderer.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/ImageRenderer.php
index ab16276..0d33303 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/ImageRenderer.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/ImageRenderer.php
@@ -13,20 +13,10 @@
final class ImageRenderer implements RendererInterface
{
- /**
- * @var RendererStyle
- */
- private $rendererStyle;
-
- /**
- * @var ImageBackEndInterface
- */
- private $imageBackEnd;
-
- public function __construct(RendererStyle $rendererStyle, ImageBackEndInterface $imageBackEnd)
- {
- $this->rendererStyle = $rendererStyle;
- $this->imageBackEnd = $imageBackEnd;
+ public function __construct(
+ private readonly RendererStyle $rendererStyle,
+ private readonly ImageBackEndInterface $imageBackEnd
+ ) {
}
/**
@@ -122,8 +112,12 @@ private function drawEye(
) : Path {
if ($fill->inheritsBothColors()) {
return $modulePath
- ->append($externalPath->translate($xTranslation, $yTranslation))
- ->append($internalPath->translate($xTranslation, $yTranslation));
+ ->append(
+ $externalPath->rotate($rotation)->translate($xTranslation, $yTranslation)
+ )
+ ->append(
+ $internalPath->rotate($rotation)->translate($xTranslation, $yTranslation)
+ );
}
$this->imageBackEnd->push();
@@ -134,13 +128,17 @@ private function drawEye(
}
if ($fill->inheritsExternalColor()) {
- $modulePath = $modulePath->append($externalPath->translate($xTranslation, $yTranslation));
+ $modulePath = $modulePath->append(
+ $externalPath->rotate($rotation)->translate($xTranslation, $yTranslation)
+ );
} else {
$this->imageBackEnd->drawPathWithColor($externalPath, $fill->getExternalColor());
}
if ($fill->inheritsInternalColor()) {
- $modulePath = $modulePath->append($internalPath->translate($xTranslation, $yTranslation));
+ $modulePath = $modulePath->append(
+ $internalPath->rotate($rotation)->translate($xTranslation, $yTranslation)
+ );
} else {
$this->imageBackEnd->drawPathWithColor($internalPath, $fill->getInternalColor());
}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Module/DotsModule.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Module/DotsModule.php
index f536e5a..c5d5c6f 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Module/DotsModule.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Module/DotsModule.php
@@ -16,18 +16,11 @@ final class DotsModule implements ModuleInterface
public const MEDIUM = .8;
public const SMALL = .6;
- /**
- * @var float
- */
- private $size;
-
- public function __construct(float $size)
+ public function __construct(private readonly float $size)
{
if ($size <= 0 || $size > 1) {
throw new InvalidArgumentException('Size must between 0 (exclusive) and 1 (inclusive)');
}
-
- $this->size = $size;
}
public function createPath(ByteMatrix $matrix) : Path
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Module/EdgeIterator/Edge.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Module/EdgeIterator/Edge.php
index 90482f2..141d66c 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Module/EdgeIterator/Edge.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Module/EdgeIterator/Edge.php
@@ -5,44 +5,26 @@
final class Edge
{
- /**
- * @var bool
- */
- private $positive;
-
/**
* @var array
*/
- private $points = [];
+ private array $points = [];
/**
* @var array|null
*/
- private $simplifiedPoints;
+ private ?array $simplifiedPoints = null;
- /**
- * @var int
- */
- private $minX = PHP_INT_MAX;
+ private int $minX = PHP_INT_MAX;
- /**
- * @var int
- */
- private $minY = PHP_INT_MAX;
+ private int $minY = PHP_INT_MAX;
- /**
- * @var int
- */
- private $maxX = -1;
+ private int $maxX = -1;
- /**
- * @var int
- */
- private $maxY = -1;
+ private int $maxY = -1;
- public function __construct(bool $positive)
+ public function __construct(private readonly bool $positive)
{
- $this->positive = $positive;
}
public function addPoint(int $x, int $y) : void
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Module/EdgeIterator/EdgeIterator.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Module/EdgeIterator/EdgeIterator.php
index eb29dc6..01f692c 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Module/EdgeIterator/EdgeIterator.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Module/EdgeIterator/EdgeIterator.php
@@ -15,22 +15,13 @@ final class EdgeIterator implements IteratorAggregate
/**
* @var int[]
*/
- private $bytes = [];
+ private array $bytes = [];
- /**
- * @var int
- */
- private $size;
+ private ?int $size;
- /**
- * @var int
- */
- private $width;
+ private int $width;
- /**
- * @var int
- */
- private $height;
+ private int $height;
public function __construct(ByteMatrix $matrix)
{
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Module/RoundnessModule.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Module/RoundnessModule.php
index 01b83c6..c730b37 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Module/RoundnessModule.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Module/RoundnessModule.php
@@ -17,12 +17,7 @@ final class RoundnessModule implements ModuleInterface
public const MEDIUM = .5;
public const SOFT = .25;
- /**
- * @var float
- */
- private $intensity;
-
- public function __construct(float $intensity)
+ public function __construct(private float $intensity)
{
if ($intensity <= 0 || $intensity > 1) {
throw new InvalidArgumentException('Intensity must between 0 (exclusive) and 1 (inclusive)');
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Module/SquareModule.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Module/SquareModule.php
index 9ab4607..8cf1d0b 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Module/SquareModule.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Module/SquareModule.php
@@ -12,10 +12,7 @@
*/
final class SquareModule implements ModuleInterface
{
- /**
- * @var self|null
- */
- private static $instance;
+ private static ?SquareModule $instance = null;
private function __construct()
{
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/Close.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/Close.php
index b07feb0..bddf2d0 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/Close.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/Close.php
@@ -5,10 +5,7 @@
final class Close implements OperationInterface
{
- /**
- * @var self|null
- */
- private static $instance;
+ private static ?Close $instance = null;
private function __construct()
{
@@ -26,4 +23,12 @@ public function translate(float $x, float $y) : OperationInterface
{
return $this;
}
+
+ /**
+ * @return self
+ */
+ public function rotate(int $degrees) : OperationInterface
+ {
+ return $this;
+ }
}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/Curve.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/Curve.php
index c067c74..5233e49 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/Curve.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/Curve.php
@@ -5,44 +5,14 @@
final class Curve implements OperationInterface
{
- /**
- * @var float
- */
- private $x1;
-
- /**
- * @var float
- */
- private $y1;
-
- /**
- * @var float
- */
- private $x2;
-
- /**
- * @var float
- */
- private $y2;
-
- /**
- * @var float
- */
- private $x3;
-
- /**
- * @var float
- */
- private $y3;
-
- public function __construct(float $x1, float $y1, float $x2, float $y2, float $x3, float $y3)
- {
- $this->x1 = $x1;
- $this->y1 = $y1;
- $this->x2 = $x2;
- $this->y2 = $y2;
- $this->x3 = $x3;
- $this->y3 = $y3;
+ public function __construct(
+ private readonly float $x1,
+ private readonly float $y1,
+ private readonly float $x2,
+ private readonly float $y2,
+ private readonly float $x3,
+ private readonly float $y3
+ ) {
}
public function getX1() : float
@@ -89,4 +59,28 @@ public function translate(float $x, float $y) : OperationInterface
$this->y3 + $y
);
}
+
+ /**
+ * @return self
+ */
+ public function rotate(int $degrees) : OperationInterface
+ {
+ $radians = deg2rad($degrees);
+ $sin = sin($radians);
+ $cos = cos($radians);
+ $x1r = $this->x1 * $cos - $this->y1 * $sin;
+ $y1r = $this->x1 * $sin + $this->y1 * $cos;
+ $x2r = $this->x2 * $cos - $this->y2 * $sin;
+ $y2r = $this->x2 * $sin + $this->y2 * $cos;
+ $x3r = $this->x3 * $cos - $this->y3 * $sin;
+ $y3r = $this->x3 * $sin + $this->y3 * $cos;
+ return new self(
+ $x1r,
+ $y1r,
+ $x2r,
+ $y2r,
+ $x3r,
+ $y3r
+ );
+ }
}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/EllipticArc.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/EllipticArc.php
index 9f2385a..ee957d4 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/EllipticArc.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/EllipticArc.php
@@ -7,57 +7,22 @@ final class EllipticArc implements OperationInterface
{
private const ZERO_TOLERANCE = 1e-05;
- /**
- * @var float
- */
- private $xRadius;
-
- /**
- * @var float
- */
- private $yRadius;
-
- /**
- * @var float
- */
- private $xAxisAngle;
-
- /**
- * @var bool
- */
- private $largeArc;
-
- /**
- * @var bool
- */
- private $sweep;
-
- /**
- * @var float
- */
- private $x;
-
- /**
- * @var float
- */
- private $y;
+ private float $xRadius;
+ private float $yRadius;
+ private float $xAxisAngle;
public function __construct(
- float $xRadius,
- float $yRadius,
- float $xAxisAngle,
- bool $largeArc,
- bool $sweep,
- float $x,
- float $y
+ float $xRadius,
+ float $yRadius,
+ float $xAxisAngle,
+ private readonly bool $largeArc,
+ private readonly bool $sweep,
+ private readonly float $x,
+ private readonly float $y
) {
$this->xRadius = abs($xRadius);
$this->yRadius = abs($yRadius);
$this->xAxisAngle = $xAxisAngle % 360;
- $this->largeArc = $largeArc;
- $this->sweep = $sweep;
- $this->x = $x;
- $this->y = $y;
}
public function getXRadius() : float
@@ -111,6 +76,27 @@ public function translate(float $x, float $y) : OperationInterface
);
}
+ /**
+ * @return self
+ */
+ public function rotate(int $degrees) : OperationInterface
+ {
+ $radians = deg2rad($degrees);
+ $sin = sin($radians);
+ $cos = cos($radians);
+ $xr = $this->x * $cos - $this->y * $sin;
+ $yr = $this->x * $sin + $this->y * $cos;
+ return new self(
+ $this->xRadius,
+ $this->yRadius,
+ $this->xAxisAngle,
+ $this->largeArc,
+ $this->sweep,
+ $xr,
+ $yr
+ );
+ }
+
/**
* Converts the elliptic arc to multiple curves.
*
@@ -179,7 +165,7 @@ private function createCurves(float $fromX, float $fromY) : array
/**
* @return float[]
*/
- private function calculateCenterPointParameters(float $fromX, float $fromY, float $xAngle)
+ private function calculateCenterPointParameters(float $fromX, float $fromY, float $xAngle): array
{
$rX = $this->xRadius;
$rY = $this->yRadius;
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/Line.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/Line.php
index 3149a39..dec46fd 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/Line.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/Line.php
@@ -5,20 +5,8 @@
final class Line implements OperationInterface
{
- /**
- * @var float
- */
- private $x;
-
- /**
- * @var float
- */
- private $y;
-
- public function __construct(float $x, float $y)
+ public function __construct(private readonly float $x, private readonly float $y)
{
- $this->x = $x;
- $this->y = $y;
}
public function getX() : float
@@ -38,4 +26,17 @@ public function translate(float $x, float $y) : OperationInterface
{
return new self($this->x + $x, $this->y + $y);
}
+
+ /**
+ * @return self
+ */
+ public function rotate(int $degrees) : OperationInterface
+ {
+ $radians = deg2rad($degrees);
+ $sin = sin($radians);
+ $cos = cos($radians);
+ $xr = $this->x * $cos - $this->y * $sin;
+ $yr = $this->x * $sin + $this->y * $cos;
+ return new self($xr, $yr);
+ }
}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/Move.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/Move.php
index 481d0dd..c3c9a56 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/Move.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/Move.php
@@ -5,20 +5,8 @@
final class Move implements OperationInterface
{
- /**
- * @var float
- */
- private $x;
-
- /**
- * @var float
- */
- private $y;
-
- public function __construct(float $x, float $y)
+ public function __construct(private readonly float $x, private readonly float $y)
{
- $this->x = $x;
- $this->y = $y;
}
public function getX() : float
@@ -38,4 +26,17 @@ public function translate(float $x, float $y) : OperationInterface
{
return new self($this->x + $x, $this->y + $y);
}
+
+ /**
+ * @return self
+ */
+ public function rotate(int $degrees) : OperationInterface
+ {
+ $radians = deg2rad($degrees);
+ $sin = sin($radians);
+ $cos = cos($radians);
+ $xr = $this->x * $cos - $this->y * $sin;
+ $yr = $this->x * $sin + $this->y * $cos;
+ return new self($xr, $yr);
+ }
}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/OperationInterface.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/OperationInterface.php
index a5fa0ed..9271555 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/OperationInterface.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/OperationInterface.php
@@ -9,4 +9,9 @@ interface OperationInterface
* Translates the operation's coordinates.
*/
public function translate(float $x, float $y) : self;
+
+ /**
+ * Rotates the operation's coordinates.
+ */
+ public function rotate(int $degrees) : self;
}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/Path.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/Path.php
index 8e5e298..3bc61ed 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/Path.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/Path/Path.php
@@ -14,7 +14,7 @@ final class Path implements IteratorAggregate
/**
* @var OperationInterface[]
*/
- private $operations = [];
+ private array $operations = [];
/**
* Moves the drawing operation to a certain position.
@@ -94,8 +94,19 @@ public function translate(float $x, float $y) : self
return $path;
}
+ public function rotate(int $degrees) : self
+ {
+ $path = new self();
+
+ foreach ($this->operations as $operation) {
+ $path->operations[] = $operation->rotate($degrees);
+ }
+
+ return $path;
+ }
+
/**
- * @return OperationInterface[]|Traversable
+ * @return Traversable
*/
public function getIterator() : Traversable
{
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/PlainTextRenderer.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/PlainTextRenderer.php
index 8aa7652..219bbf3 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/PlainTextRenderer.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/PlainTextRenderer.php
@@ -28,14 +28,8 @@ final class PlainTextRenderer implements RendererInterface
*/
private const EMPTY_BLOCK = "\xc2\xa0";
- /**
- * @var int
- */
- private $margin;
-
- public function __construct(int $margin = 2)
+ public function __construct(private readonly int $margin = 2)
{
- $this->margin = $margin;
}
/**
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/EyeFill.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/EyeFill.php
index 46abc22..9953b55 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/EyeFill.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/EyeFill.php
@@ -8,25 +8,12 @@
final class EyeFill
{
- /**
- * @var ColorInterface|null
- */
- private $externalColor;
+ private static ?EyeFill $inherit = null;
- /**
- * @var ColorInterface|null
- */
- private $internalColor;
-
- /**
- * @var self|null
- */
- private static $inherit;
-
- public function __construct(?ColorInterface $externalColor, ?ColorInterface $internalColor)
- {
- $this->externalColor = $externalColor;
- $this->internalColor = $internalColor;
+ public function __construct(
+ private readonly ?ColorInterface $externalColor,
+ private readonly ?ColorInterface $internalColor
+ ) {
}
public static function uniform(ColorInterface $color) : self
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/Fill.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/Fill.php
index d54268e..19de25d 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/Fill.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/Fill.php
@@ -9,55 +9,16 @@
final class Fill
{
- /**
- * @var ColorInterface
- */
- private $backgroundColor;
-
- /**
- * @var ColorInterface|null
- */
- private $foregroundColor;
-
- /**
- * @var Gradient|null
- */
- private $foregroundGradient;
-
- /**
- * @var EyeFill
- */
- private $topLeftEyeFill;
-
- /**
- * @var EyeFill
- */
- private $topRightEyeFill;
-
- /**
- * @var EyeFill
- */
- private $bottomLeftEyeFill;
-
- /**
- * @var self|null
- */
- private static $default;
+ private static ?Fill $default = null;
private function __construct(
- ColorInterface $backgroundColor,
- ?ColorInterface $foregroundColor,
- ?Gradient $foregroundGradient,
- EyeFill $topLeftEyeFill,
- EyeFill $topRightEyeFill,
- EyeFill $bottomLeftEyeFill
+ private readonly ColorInterface $backgroundColor,
+ private readonly ?ColorInterface $foregroundColor,
+ private readonly ?Gradient $foregroundGradient,
+ private readonly EyeFill $topLeftEyeFill,
+ private readonly EyeFill $topRightEyeFill,
+ private readonly EyeFill $bottomLeftEyeFill
) {
- $this->backgroundColor = $backgroundColor;
- $this->foregroundColor = $foregroundColor;
- $this->foregroundGradient = $foregroundGradient;
- $this->topLeftEyeFill = $topLeftEyeFill;
- $this->topRightEyeFill = $topRightEyeFill;
- $this->bottomLeftEyeFill = $bottomLeftEyeFill;
}
public static function default() : self
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/Gradient.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/Gradient.php
index 3813dfd..eea4031 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/Gradient.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/Gradient.php
@@ -7,26 +7,11 @@
final class Gradient
{
- /**
- * @var ColorInterface
- */
- private $startColor;
-
- /**
- * @var ColorInterface
- */
- private $endColor;
-
- /**
- * @var GradientType
- */
- private $type;
-
- public function __construct(ColorInterface $startColor, ColorInterface $endColor, GradientType $type)
- {
- $this->startColor = $startColor;
- $this->endColor = $endColor;
- $this->type = $type;
+ public function __construct(
+ private readonly ColorInterface $startColor,
+ private readonly ColorInterface $endColor,
+ private readonly GradientType $type
+ ) {
}
public function getStartColor() : ColorInterface
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/RendererStyle.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/RendererStyle.php
index e03e099..aa963ff 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/RendererStyle.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/RendererStyle.php
@@ -10,40 +10,19 @@
final class RendererStyle
{
- /**
- * @var int
- */
- private $size;
+ private ModuleInterface $module;
- /**
- * @var int
- */
- private $margin;
+ private EyeInterface|null $eye;
- /**
- * @var ModuleInterface
- */
- private $module;
-
- /**
- * @var EyeInterface|null
- */
- private $eye;
-
- /**
- * @var Fill
- */
- private $fill;
+ private Fill $fill;
public function __construct(
- int $size,
- int $margin = 4,
+ private int $size,
+ private int $margin = 4,
?ModuleInterface $module = null,
?EyeInterface $eye = null,
?Fill $fill = null
) {
- $this->margin = $margin;
- $this->size = $size;
$this->module = $module ?: SquareModule::instance();
$this->eye = $eye ?: new ModuleEye($this->module);
$this->fill = $fill ?: Fill::default();
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/src/Writer.php b/thirdparty/vendor/bacon/bacon-qr-code/src/Writer.php
index d5bdc5c..d7f7ebb 100644
--- a/thirdparty/vendor/bacon/bacon-qr-code/src/Writer.php
+++ b/thirdparty/vendor/bacon/bacon-qr-code/src/Writer.php
@@ -14,19 +14,11 @@
*/
final class Writer
{
- /**
- * Renderer instance.
- *
- * @var RendererInterface
- */
- private $renderer;
-
/**
* Creates a new writer with a specific renderer.
*/
- public function __construct(RendererInterface $renderer)
+ public function __construct(private readonly RendererInterface $renderer)
{
- $this->renderer = $renderer;
}
/**
@@ -39,7 +31,7 @@ public function __construct(RendererInterface $renderer)
*/
public function writeString(
string $content,
- string $encoding = Encoder::DEFAULT_BYTE_MODE_ECODING,
+ string $encoding = Encoder::DEFAULT_BYTE_MODE_ENCODING,
?ErrorCorrectionLevel $ecLevel = null,
?Version $forcedVersion = null
) : string {
@@ -62,7 +54,7 @@ public function writeString(
public function writeFile(
string $content,
string $filename,
- string $encoding = Encoder::DEFAULT_BYTE_MODE_ECODING,
+ string $encoding = Encoder::DEFAULT_BYTE_MODE_ENCODING,
?ErrorCorrectionLevel $ecLevel = null,
?Version $forcedVersion = null
) : void {
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/test/Common/BitArrayTest.php b/thirdparty/vendor/bacon/bacon-qr-code/test/Common/BitArrayTest.php
deleted file mode 100644
index add798b..0000000
--- a/thirdparty/vendor/bacon/bacon-qr-code/test/Common/BitArrayTest.php
+++ /dev/null
@@ -1,222 +0,0 @@
-assertFalse($array->get($i));
- $array->set($i);
- $this->assertTrue($array->get($i));
- }
- }
-
- public function testGetNextSet1() : void
- {
- $array = new BitArray(32);
-
- for ($i = 0; $i < $array->getSize(); ++$i) {
- if ($this->getPhpUnitMajorVersion() === 7) {
- $this->assertEquals($i, 32, '', $array->getNextSet($i));
- } else {
- $this->assertEqualsWithDelta($i, 32, $array->getNextSet($i));
- }
- }
-
- $array = new BitArray(33);
-
- for ($i = 0; $i < $array->getSize(); ++$i) {
- if ($this->getPhpUnitMajorVersion() === 7) {
- $this->assertEquals($i, 33, '', $array->getNextSet($i));
- } else {
- $this->assertEqualsWithDelta($i, 33, $array->getNextSet($i));
- }
- }
- }
-
- public function testGetNextSet2() : void
- {
- $array = new BitArray(33);
-
- for ($i = 0; $i < $array->getSize(); ++$i) {
- if ($this->getPhpUnitMajorVersion() === 7) {
- $this->assertEquals($i, $i <= 31 ? 31 : 33, '', $array->getNextSet($i));
- } else {
- $this->assertEqualsWithDelta($i, $i <= 31 ? 31 : 33, $array->getNextSet($i));
- }
- }
-
- $array = new BitArray(33);
-
- for ($i = 0; $i < $array->getSize(); ++$i) {
- if ($this->getPhpUnitMajorVersion() === 7) {
- $this->assertEquals($i, 32, '', $array->getNextSet($i));
- } else {
- $this->assertEqualsWithDelta($i, 32, $array->getNextSet($i));
- }
- }
- }
-
- public function testGetNextSet3() : void
- {
- $array = new BitArray(63);
- $array->set(31);
- $array->set(32);
-
- for ($i = 0; $i < $array->getSize(); ++$i) {
- if ($i <= 31) {
- $expected = 31;
- } elseif ($i <= 32) {
- $expected = 32;
- } else {
- $expected = 63;
- }
-
- if ($this->getPhpUnitMajorVersion() === 7) {
- $this->assertEquals($i, $expected, '', $array->getNextSet($i));
- } else {
- $this->assertEqualsWithDelta($i, $expected, $array->getNextSet($i));
- }
- }
- }
-
- public function testGetNextSet4() : void
- {
- $array = new BitArray(63);
- $array->set(33);
- $array->set(40);
-
- for ($i = 0; $i < $array->getSize(); ++$i) {
- if ($i <= 33) {
- $expected = 33;
- } elseif ($i <= 40) {
- $expected = 40;
- } else {
- $expected = 63;
- }
-
- if ($this->getPhpUnitMajorVersion() === 7) {
- $this->assertEquals($i, $expected, '', $array->getNextSet($i));
- } else {
- $this->assertEqualsWithDelta($i, $expected, $array->getNextSet($i));
- }
- }
- }
-
- public function testGetNextSet5() : void
- {
- mt_srand(0xdeadbeef, MT_RAND_PHP);
-
- for ($i = 0; $i < 10; ++$i) {
- $array = new BitArray(mt_rand(1, 100));
- $numSet = mt_rand(0, 19);
-
- for ($j = 0; $j < $numSet; ++$j) {
- $array->set(mt_rand(0, $array->getSize() - 1));
- }
-
- $numQueries = mt_rand(0, 19);
-
- for ($j = 0; $j < $numQueries; ++$j) {
- $query = mt_rand(0, $array->getSize() - 1);
- $expected = $query;
-
- while ($expected < $array->getSize() && ! $array->get($expected)) {
- ++$expected;
- }
-
- $actual = $array->getNextSet($query);
-
- if ($actual !== $expected) {
- $array->getNextSet($query);
- }
-
- $this->assertEquals($expected, $actual);
- }
- }
- }
-
- public function testSetBulk() : void
- {
- $array = new BitArray(64);
- $array->setBulk(32, 0xFFFF0000);
-
- for ($i = 0; $i < 48; ++$i) {
- $this->assertFalse($array->get($i));
- }
-
- for ($i = 48; $i < 64; ++$i) {
- $this->assertTrue($array->get($i));
- }
- }
-
- public function testClear() : void
- {
- $array = new BitArray(32);
-
- for ($i = 0; $i < 32; ++$i) {
- $array->set($i);
- }
-
- $array->clear();
-
- for ($i = 0; $i < 32; ++$i) {
- $this->assertFalse($array->get($i));
- }
- }
-
- public function testGetArray() : void
- {
- $array = new BitArray(64);
- $array->set(0);
- $array->set(63);
-
- $ints = $array->getBitArray();
-
- $this->assertSame(1, $ints[0]);
- $this->assertSame(0x80000000, $ints[1]);
- }
-
- public function testIsRange() : void
- {
- $array = new BitArray(64);
- $this->assertTrue($array->isRange(0, 64, false));
- $this->assertFalse($array->isRange(0, 64, true));
-
- $array->set(32);
- $this->assertTrue($array->isRange(32, 33, true));
-
- $array->set(31);
- $this->assertTrue($array->isRange(31, 33, true));
-
- $array->set(34);
- $this->assertFalse($array->isRange(31, 35, true));
-
- for ($i = 0; $i < 31; ++$i) {
- $array->set($i);
- }
-
- $this->assertTrue($array->isRange(0, 33, true));
-
- for ($i = 33; $i < 64; ++$i) {
- $array->set($i);
- }
-
- $this->assertTrue($array->isRange(0, 64, true));
- $this->assertFalse($array->isRange(0, 64, false));
- }
-}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/test/Common/BitMatrixTest.php b/thirdparty/vendor/bacon/bacon-qr-code/test/Common/BitMatrixTest.php
deleted file mode 100644
index 8ad86d4..0000000
--- a/thirdparty/vendor/bacon/bacon-qr-code/test/Common/BitMatrixTest.php
+++ /dev/null
@@ -1,115 +0,0 @@
-assertEquals(33, $matrix->getHeight());
-
- for ($y = 0; $y < 33; ++$y) {
- for ($x = 0; $x < 33; ++$x) {
- if ($y * $x % 3 === 0) {
- $matrix->set($x, $y);
- }
- }
- }
-
- for ($y = 0; $y < 33; $y++) {
- for ($x = 0; $x < 33; ++$x) {
- $this->assertSame(0 === $x * $y % 3, $matrix->get($x, $y));
- }
- }
- }
-
- public function testSetRegion() : void
- {
- $matrix = new BitMatrix(5);
- $matrix->setRegion(1, 1, 3, 3);
-
- for ($y = 0; $y < 5; ++$y) {
- for ($x = 0; $x < 5; ++$x) {
- $this->assertSame($y >= 1 && $y <= 3 && $x >= 1 && $x <= 3, $matrix->get($x, $y));
- }
- }
- }
-
- public function testRectangularMatrix() : void
- {
- $matrix = new BitMatrix(75, 20);
- $this->assertSame(75, $matrix->getWidth());
- $this->assertSame(20, $matrix->getHeight());
-
- $matrix->set(10, 0);
- $matrix->set(11, 1);
- $matrix->set(50, 2);
- $matrix->set(51, 3);
- $matrix->flip(74, 4);
- $matrix->flip(0, 5);
-
- $this->assertTrue($matrix->get(10, 0));
- $this->assertTrue($matrix->get(11, 1));
- $this->assertTrue($matrix->get(50, 2));
- $this->assertTrue($matrix->get(51, 3));
- $this->assertTrue($matrix->get(74, 4));
- $this->assertTrue($matrix->get(0, 5));
-
- $matrix->flip(50, 2);
- $matrix->flip(51, 3);
-
- $this->assertFalse($matrix->get(50, 2));
- $this->assertFalse($matrix->get(51, 3));
- }
-
- public function testRectangularSetRegion() : void
- {
- $matrix = new BitMatrix(320, 240);
- $this->assertSame(320, $matrix->getWidth());
- $this->assertSame(240, $matrix->getHeight());
-
- $matrix->setRegion(105, 22, 80, 12);
-
- for ($y = 0; $y < 240; ++$y) {
- for ($x = 0; $x < 320; ++$x) {
- $this->assertEquals($y >= 22 && $y < 34 && $x >= 105 && $x < 185, $matrix->get($x, $y));
- }
- }
- }
-
- public function testGetRow() : void
- {
- $matrix = new BitMatrix(102, 5);
-
- for ($x = 0; $x < 102; ++$x) {
- if (0 === ($x & 3)) {
- $matrix->set($x, 2);
- }
- }
-
- $array1 = $matrix->getRow(2, null);
- $this->assertSame(102, $array1->getSize());
-
- $array2 = new BitArray(60);
- $array2 = $matrix->getRow(2, $array2);
- $this->assertSame(102, $array2->getSize());
-
- $array3 = new BitArray(200);
- $array3 = $matrix->getRow(2, $array3);
- $this->assertSame(200, $array3->getSize());
-
- for ($x = 0; $x < 102; ++$x) {
- $on = (0 === ($x & 3));
-
- $this->assertSame($on, $array1->get($x));
- $this->assertSame($on, $array2->get($x));
- $this->assertSame($on, $array3->get($x));
- }
- }
-}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/test/Common/BitUtilsTest.php b/thirdparty/vendor/bacon/bacon-qr-code/test/Common/BitUtilsTest.php
deleted file mode 100644
index 2904d31..0000000
--- a/thirdparty/vendor/bacon/bacon-qr-code/test/Common/BitUtilsTest.php
+++ /dev/null
@@ -1,25 +0,0 @@
-assertSame(1, BitUtils::unsignedRightShift(1, 0));
- $this->assertSame(1, BitUtils::unsignedRightShift(10, 3));
- $this->assertSame(536870910, BitUtils::unsignedRightShift(-10, 3));
- }
-
- public function testNumberOfTrailingZeros() : void
- {
- $this->assertSame(32, BitUtils::numberOfTrailingZeros(0));
- $this->assertSame(1, BitUtils::numberOfTrailingZeros(10));
- $this->assertSame(0, BitUtils::numberOfTrailingZeros(15));
- $this->assertSame(2, BitUtils::numberOfTrailingZeros(20));
- }
-}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/test/Common/ErrorCorrectionLevelTest.php b/thirdparty/vendor/bacon/bacon-qr-code/test/Common/ErrorCorrectionLevelTest.php
deleted file mode 100644
index 369b5d9..0000000
--- a/thirdparty/vendor/bacon/bacon-qr-code/test/Common/ErrorCorrectionLevelTest.php
+++ /dev/null
@@ -1,25 +0,0 @@
-assertSame(0x0, ErrorCorrectionLevel::M()->getBits());
- $this->assertSame(0x1, ErrorCorrectionLevel::L()->getBits());
- $this->assertSame(0x2, ErrorCorrectionLevel::H()->getBits());
- $this->assertSame(0x3, ErrorCorrectionLevel::Q()->getBits());
- }
-
- public function testInvalidErrorCorrectionLevelThrowsException() : void
- {
- $this->expectException(OutOfBoundsException::class);
- ErrorCorrectionLevel::forBits(4);
- }
-}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/test/Common/FormatInformationTest.php b/thirdparty/vendor/bacon/bacon-qr-code/test/Common/FormatInformationTest.php
deleted file mode 100644
index 39534a2..0000000
--- a/thirdparty/vendor/bacon/bacon-qr-code/test/Common/FormatInformationTest.php
+++ /dev/null
@@ -1,94 +0,0 @@
-assertSame(0, FormatInformation::numBitsDiffering(1, 1));
- $this->assertSame(1, FormatInformation::numBitsDiffering(0, 2));
- $this->assertSame(2, FormatInformation::numBitsDiffering(1, 2));
- $this->assertEquals(32, FormatInformation::numBitsDiffering(-1, 0));
- }
-
- public function testDecode() : void
- {
- $expected = FormatInformation::decodeFormatInformation(
- self::MASKED_TEST_FORMAT_INFO,
- self::MASKED_TEST_FORMAT_INFO
- );
-
- $this->assertNotNull($expected);
- $this->assertSame(7, $expected->getDataMask());
- $this->assertSame(ErrorCorrectionLevel::Q(), $expected->getErrorCorrectionLevel());
-
- $this->assertEquals(
- $expected,
- FormatInformation::decodeFormatInformation(
- self::UNMAKSED_TEST_FORMAT_INFO,
- self::MASKED_TEST_FORMAT_INFO
- )
- );
- }
-
- public function testDecodeWithBitDifference() : void
- {
- $expected = FormatInformation::decodeFormatInformation(
- self::MASKED_TEST_FORMAT_INFO,
- self::MASKED_TEST_FORMAT_INFO
- );
-
- $this->assertEquals(
- $expected,
- FormatInformation::decodeFormatInformation(
- self::MASKED_TEST_FORMAT_INFO ^ 0x1,
- self::MASKED_TEST_FORMAT_INFO ^ 0x1
- )
- );
- $this->assertEquals(
- $expected,
- FormatInformation::decodeFormatInformation(
- self::MASKED_TEST_FORMAT_INFO ^ 0x3,
- self::MASKED_TEST_FORMAT_INFO ^ 0x3
- )
- );
- $this->assertEquals(
- $expected,
- FormatInformation::decodeFormatInformation(
- self::MASKED_TEST_FORMAT_INFO ^ 0x7,
- self::MASKED_TEST_FORMAT_INFO ^ 0x7
- )
- );
- $this->assertNull(
- FormatInformation::decodeFormatInformation(
- self::MASKED_TEST_FORMAT_INFO ^ 0xf,
- self::MASKED_TEST_FORMAT_INFO ^ 0xf
- )
- );
- }
-
- public function testDecodeWithMisRead() : void
- {
- $expected = FormatInformation::decodeFormatInformation(
- self::MASKED_TEST_FORMAT_INFO,
- self::MASKED_TEST_FORMAT_INFO
- );
-
- $this->assertEquals(
- $expected,
- FormatInformation::decodeFormatInformation(
- self::MASKED_TEST_FORMAT_INFO ^ 0x3,
- self::MASKED_TEST_FORMAT_INFO ^ 0xf
- )
- );
- }
-}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/test/Common/ModeTest.php b/thirdparty/vendor/bacon/bacon-qr-code/test/Common/ModeTest.php
deleted file mode 100644
index 51fcb3e..0000000
--- a/thirdparty/vendor/bacon/bacon-qr-code/test/Common/ModeTest.php
+++ /dev/null
@@ -1,19 +0,0 @@
-assertSame(0x0, Mode::TERMINATOR()->getBits());
- $this->assertSame(0x1, Mode::NUMERIC()->getBits());
- $this->assertSame(0x2, Mode::ALPHANUMERIC()->getBits());
- $this->assertSame(0x4, Mode::BYTE()->getBits());
- $this->assertSame(0x8, Mode::KANJI()->getBits());
- }
-}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/test/Common/ReedSolomonCodecTest.php b/thirdparty/vendor/bacon/bacon-qr-code/test/Common/ReedSolomonCodecTest.php
deleted file mode 100644
index 47975b5..0000000
--- a/thirdparty/vendor/bacon/bacon-qr-code/test/Common/ReedSolomonCodecTest.php
+++ /dev/null
@@ -1,96 +0,0 @@
-encode($block, $parity);
-
- // Copy parity into test blocks
- for ($i = 0; $i < $numRoots; ++$i) {
- $block[$i + $dataSize] = $parity[$i];
- $tBlock[$i + $dataSize] = $parity[$i];
- }
-
- // Seed with errors
- for ($i = 0; $i < $errors; ++$i) {
- $errorValue = mt_rand(1, $blockSize);
-
- do {
- $errorLocation = mt_rand(0, $blockSize);
- } while (0 !== $errorLocations[$errorLocation]);
-
- $errorLocations[$errorLocation] = 1;
-
- if (mt_rand(0, 1)) {
- $erasures[] = $errorLocation;
- }
-
- $tBlock[$errorLocation] ^= $errorValue;
- }
-
- $erasures = SplFixedArray::fromArray($erasures, false);
-
- // Decode the errored block
- $foundErrors = $codec->decode($tBlock, $erasures);
-
- if ($errors > 0 && null === $foundErrors) {
- $this->assertSame($block, $tBlock, 'Decoder failed to correct errors');
- }
-
- $this->assertSame($errors, $foundErrors, 'Found errors do not equal expected errors');
-
- for ($i = 0; $i < $foundErrors; ++$i) {
- if (0 === $errorLocations[$erasures[$i]]) {
- $this->fail(sprintf('Decoder indicates error in location %d without error', $erasures[$i]));
- }
- }
-
- $this->assertEquals($block, $tBlock, 'Decoder did not correct errors');
- }
- }
-}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/test/Common/VersionTest.php b/thirdparty/vendor/bacon/bacon-qr-code/test/Common/VersionTest.php
deleted file mode 100644
index f6f038b..0000000
--- a/thirdparty/vendor/bacon/bacon-qr-code/test/Common/VersionTest.php
+++ /dev/null
@@ -1,78 +0,0 @@
-assertNotNull($version);
- $this->assertEquals($versionNumber, $version->getVersionNumber());
- $this->assertNotNull($version->getAlignmentPatternCenters());
-
- if ($versionNumber > 1) {
- $this->assertTrue(count($version->getAlignmentPatternCenters()) > 0);
- }
-
- $this->assertEquals($dimension, $version->getDimensionForVersion());
- $this->assertNotNull($version->getEcBlocksForLevel(ErrorCorrectionLevel::H()));
- $this->assertNotNull($version->getEcBlocksForLevel(ErrorCorrectionLevel::L()));
- $this->assertNotNull($version->getEcBlocksForLevel(ErrorCorrectionLevel::M()));
- $this->assertNotNull($version->getEcBlocksForLevel(ErrorCorrectionLevel::Q()));
- $this->assertNotNull($version->buildFunctionPattern());
- }
-
- /**
- * @dataProvider versions
- */
- public function testGetProvisionalVersionForDimension(int $versionNumber, int $dimension) : void
- {
- $this->assertSame(
- $versionNumber,
- Version::getProvisionalVersionForDimension($dimension)->getVersionNumber()
- );
- }
-
- /**
- * @dataProvider decodeInformation
- */
- public function testDecodeVersionInformation(int $expectedVersion, int $mask) : void
- {
- $version = Version::decodeVersionInformation($mask);
- $this->assertNotNull($version);
- $this->assertSame($expectedVersion, $version->getVersionNumber());
- }
-}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/test/Encoder/EncoderTest.php b/thirdparty/vendor/bacon/bacon-qr-code/test/Encoder/EncoderTest.php
deleted file mode 100644
index 9baa66b..0000000
--- a/thirdparty/vendor/bacon/bacon-qr-code/test/Encoder/EncoderTest.php
+++ /dev/null
@@ -1,487 +0,0 @@
-getMethods(ReflectionMethod::IS_STATIC) as $method) {
- $method->setAccessible(true);
- $this->methods[$method->getName()] = $method;
- }
- }
-
- public function testGetAlphanumericCode() : void
- {
- // The first ten code points are numbers.
- for ($i = 0; $i < 10; ++$i) {
- $this->assertSame($i, $this->methods['getAlphanumericCode']->invoke(null, ord('0') + $i));
- }
-
- // The next 26 code points are capital alphabet letters.
- for ($i = 10; $i < 36; ++$i) {
- // The first ten code points are numbers
- $this->assertSame($i, $this->methods['getAlphanumericCode']->invoke(null, ord('A') + $i - 10));
- }
-
- // Others are symbol letters.
- $this->assertSame(36, $this->methods['getAlphanumericCode']->invoke(null, ord(' ')));
- $this->assertSame(37, $this->methods['getAlphanumericCode']->invoke(null, ord('$')));
- $this->assertSame(38, $this->methods['getAlphanumericCode']->invoke(null, ord('%')));
- $this->assertSame(39, $this->methods['getAlphanumericCode']->invoke(null, ord('*')));
- $this->assertSame(40, $this->methods['getAlphanumericCode']->invoke(null, ord('+')));
- $this->assertSame(41, $this->methods['getAlphanumericCode']->invoke(null, ord('-')));
- $this->assertSame(42, $this->methods['getAlphanumericCode']->invoke(null, ord('.')));
- $this->assertSame(43, $this->methods['getAlphanumericCode']->invoke(null, ord('/')));
- $this->assertSame(44, $this->methods['getAlphanumericCode']->invoke(null, ord(':')));
-
- // Should return -1 for other letters.
- $this->assertSame(-1, $this->methods['getAlphanumericCode']->invoke(null, ord('a')));
- $this->assertSame(-1, $this->methods['getAlphanumericCode']->invoke(null, ord('#')));
- $this->assertSame(-1, $this->methods['getAlphanumericCode']->invoke(null, ord("\0")));
- }
-
- public function testChooseMode() : void
- {
- // Numeric mode
- $this->assertSame(Mode::NUMERIC(), $this->methods['chooseMode']->invoke(null, '0'));
- $this->assertSame(Mode::NUMERIC(), $this->methods['chooseMode']->invoke(null, '0123456789'));
-
- // Alphanumeric mode
- $this->assertSame(Mode::ALPHANUMERIC(), $this->methods['chooseMode']->invoke(null, 'A'));
- $this->assertSame(
- Mode::ALPHANUMERIC(),
- $this->methods['chooseMode']->invoke(null, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:')
- );
-
- // 8-bit byte mode
- $this->assertSame(Mode::BYTE(), $this->methods['chooseMode']->invoke(null, 'a'));
- $this->assertSame(Mode::BYTE(), $this->methods['chooseMode']->invoke(null, '#'));
- $this->assertSame(Mode::BYTE(), $this->methods['chooseMode']->invoke(null, ''));
-
- // AIUE in Hiragana in SHIFT-JIS
- $this->assertSame(Mode::BYTE(), $this->methods['chooseMode']->invoke(null, "\x8\xa\x8\xa\x8\xa\x8\xa6"));
-
- // Nihon in Kanji in SHIFT-JIS
- $this->assertSame(Mode::BYTE(), $this->methods['chooseMode']->invoke(null, "\x9\xf\x9\x7b"));
-
- // Sou-Utso-Byou in Kanji in SHIFT-JIS
- $this->assertSame(Mode::BYTE(), $this->methods['chooseMode']->invoke(null, "\xe\x4\x9\x5\x9\x61"));
- }
-
- public function testEncode() : void
- {
- $qrCode = Encoder::encode('ABCDEF', ErrorCorrectionLevel::H());
- $expected = "<<\n"
- . " mode: ALPHANUMERIC\n"
- . " ecLevel: H\n"
- . " version: 1\n"
- . " maskPattern: 0\n"
- . " matrix:\n"
- . " 1 1 1 1 1 1 1 0 1 1 1 1 0 0 1 1 1 1 1 1 1\n"
- . " 1 0 0 0 0 0 1 0 0 1 1 1 0 0 1 0 0 0 0 0 1\n"
- . " 1 0 1 1 1 0 1 0 0 1 0 1 1 0 1 0 1 1 1 0 1\n"
- . " 1 0 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1 1 1 0 1\n"
- . " 1 0 1 1 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1\n"
- . " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 1\n"
- . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n"
- . " 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0\n"
- . " 0 0 1 0 1 1 1 0 1 1 0 0 1 1 0 0 0 1 0 0 1\n"
- . " 1 0 1 1 1 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0\n"
- . " 0 0 1 1 0 0 1 0 1 0 0 0 1 0 1 0 1 0 1 1 0\n"
- . " 1 1 0 1 0 1 0 1 1 1 0 1 0 1 0 0 0 0 0 1 0\n"
- . " 0 0 1 1 0 1 1 1 1 0 0 0 1 0 1 0 1 1 1 1 0\n"
- . " 0 0 0 0 0 0 0 0 1 0 0 1 1 1 0 1 0 1 0 0 0\n"
- . " 1 1 1 1 1 1 1 0 0 0 1 0 1 0 1 1 0 0 0 0 1\n"
- . " 1 0 0 0 0 0 1 0 1 1 1 1 0 1 0 1 1 1 1 0 1\n"
- . " 1 0 1 1 1 0 1 0 1 0 1 1 0 1 0 1 0 0 0 0 1\n"
- . " 1 0 1 1 1 0 1 0 0 1 1 0 1 1 1 1 0 1 0 1 0\n"
- . " 1 0 1 1 1 0 1 0 1 0 0 0 1 0 1 0 1 1 1 0 1\n"
- . " 1 0 0 0 0 0 1 0 0 1 1 0 1 1 0 1 0 0 0 1 1\n"
- . " 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 1 0 1\n"
- . ">>\n";
-
- $this->assertSame($expected, (string) $qrCode);
- }
-
- public function testSimpleUtf8Eci() : void
- {
- $qrCode = Encoder::encode('hello', ErrorCorrectionLevel::H(), 'utf-8');
- $expected = "<<\n"
- . " mode: BYTE\n"
- . " ecLevel: H\n"
- . " version: 1\n"
- . " maskPattern: 3\n"
- . " matrix:\n"
- . " 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1\n"
- . " 1 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 1\n"
- . " 1 0 1 1 1 0 1 0 0 1 0 1 0 0 1 0 1 1 1 0 1\n"
- . " 1 0 1 1 1 0 1 0 0 1 1 0 1 0 1 0 1 1 1 0 1\n"
- . " 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1\n"
- . " 1 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1\n"
- . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n"
- . " 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0\n"
- . " 0 0 1 1 0 0 1 1 1 1 0 0 0 1 1 0 1 0 0 0 0\n"
- . " 0 0 1 1 1 0 0 0 0 0 1 1 0 0 0 1 0 1 1 1 0\n"
- . " 0 1 0 1 0 1 1 1 0 1 0 1 0 0 0 0 0 1 1 1 1\n"
- . " 1 1 0 0 1 0 0 1 1 0 0 1 1 1 1 0 1 0 1 1 0\n"
- . " 0 0 0 0 1 0 1 1 1 1 0 0 0 0 0 1 0 0 1 0 0\n"
- . " 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 0 0 0 1\n"
- . " 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 0 0\n"
- . " 1 0 0 0 0 0 1 0 0 0 1 0 0 1 1 1 1 1 1 0 1\n"
- . " 1 0 1 1 1 0 1 0 0 1 0 0 0 0 1 1 0 0 0 0 0\n"
- . " 1 0 1 1 1 0 1 0 1 1 1 0 1 0 0 0 1 1 0 0 0\n"
- . " 1 0 1 1 1 0 1 0 1 1 0 0 0 1 0 0 1 0 0 0 0\n"
- . " 1 0 0 0 0 0 1 0 0 0 0 1 1 0 1 0 1 0 1 1 0\n"
- . " 1 1 1 1 1 1 1 0 0 1 0 1 1 1 0 1 1 0 0 0 0\n"
- . ">>\n";
-
- $this->assertSame($expected, (string) $qrCode);
- }
-
- public function testAppendModeInfo() : void
- {
- $bits = new BitArray();
- $this->methods['appendModeInfo']->invoke(null, Mode::NUMERIC(), $bits);
- $this->assertSame(' ...X', (string) $bits);
- }
-
- public function testAppendLengthInfo() : void
- {
- // 1 letter (1/1), 10 bits.
- $bits = new BitArray();
- $this->methods['appendLengthInfo']->invoke(
- null,
- 1,
- Version::getVersionForNumber(1),
- Mode::NUMERIC(),
- $bits
- );
- $this->assertSame(' ........ .X', (string) $bits);
-
- // 2 letters (2/1), 11 bits.
- $bits = new BitArray();
- $this->methods['appendLengthInfo']->invoke(
- null,
- 2,
- Version::getVersionForNumber(10),
- Mode::ALPHANUMERIC(),
- $bits
- );
- $this->assertSame(' ........ .X.', (string) $bits);
-
- // 255 letters (255/1), 16 bits.
- $bits = new BitArray();
- $this->methods['appendLengthInfo']->invoke(
- null,
- 255,
- Version::getVersionForNumber(27),
- Mode::BYTE(),
- $bits
- );
- $this->assertSame(' ........ XXXXXXXX', (string) $bits);
-
- // 512 letters (1024/2), 12 bits.
- $bits = new BitArray();
- $this->methods['appendLengthInfo']->invoke(
- null,
- 512,
- Version::getVersionForNumber(40),
- Mode::KANJI(),
- $bits
- );
- $this->assertSame(' ..X..... ....', (string) $bits);
- }
-
- public function testAppendBytes() : void
- {
- // Should use appendNumericBytes.
- // 1 = 01 = 0001 in 4 bits.
- $bits = new BitArray();
- $this->methods['appendBytes']->invoke(
- null,
- '1',
- Mode::NUMERIC(),
- $bits,
- Encoder::DEFAULT_BYTE_MODE_ECODING
- );
- $this->assertSame(' ...X', (string) $bits);
-
- // Should use appendAlphaNumericBytes.
- // A = 10 = 0xa = 001010 in 6 bits.
- $bits = new BitArray();
- $this->methods['appendBytes']->invoke(
- null,
- 'A',
- Mode::ALPHANUMERIC(),
- $bits,
- Encoder::DEFAULT_BYTE_MODE_ECODING
- );
- $this->assertSame(' ..X.X.', (string) $bits);
-
- // Should use append8BitBytes.
- // 0x61, 0x62, 0x63
- $bits = new BitArray();
- $this->methods['appendBytes']->invoke(
- null,
- 'abc',
- Mode::BYTE(),
- $bits,
- Encoder::DEFAULT_BYTE_MODE_ECODING
- );
- $this->assertSame(' .XX....X .XX...X. .XX...XX', (string) $bits);
-
- // Should use appendKanjiBytes.
- // 0x93, 0x5f
- $bits = new BitArray();
- $this->methods['appendBytes']->invoke(
- null,
- "\x93\x5f",
- Mode::KANJI(),
- $bits,
- Encoder::DEFAULT_BYTE_MODE_ECODING
- );
- $this->assertSame(' .XX.XX.. XXXXX', (string) $bits);
-
- // Lower letters such as 'a' cannot be encoded in alphanumeric mode.
- $this->expectException(WriterException::class);
- $this->methods['appendBytes']->invoke(
- null,
- 'a',
- Mode::ALPHANUMERIC(),
- $bits,
- Encoder::DEFAULT_BYTE_MODE_ECODING
- );
- }
-
- public function testTerminateBits() : void
- {
- $bits = new BitArray();
- $this->methods['terminateBits']->invoke(null, 0, $bits);
- $this->assertSame('', (string) $bits);
-
- $bits = new BitArray();
- $this->methods['terminateBits']->invoke(null, 1, $bits);
- $this->assertSame(' ........', (string) $bits);
-
- $bits = new BitArray();
- $bits->appendBits(0, 3);
- $this->methods['terminateBits']->invoke(null, 1, $bits);
- $this->assertSame(' ........', (string) $bits);
-
- $bits = new BitArray();
- $bits->appendBits(0, 5);
- $this->methods['terminateBits']->invoke(null, 1, $bits);
- $this->assertSame(' ........', (string) $bits);
-
- $bits = new BitArray();
- $bits->appendBits(0, 8);
- $this->methods['terminateBits']->invoke(null, 1, $bits);
- $this->assertSame(' ........', (string) $bits);
-
- $bits = new BitArray();
- $this->methods['terminateBits']->invoke(null, 2, $bits);
- $this->assertSame(' ........ XXX.XX..', (string) $bits);
-
- $bits = new BitArray();
- $bits->appendBits(0, 1);
- $this->methods['terminateBits']->invoke(null, 3, $bits);
- $this->assertSame(' ........ XXX.XX.. ...X...X', (string) $bits);
- }
-
- public function testGetNumDataBytesAndNumEcBytesForBlockId() : void
- {
- // Version 1-H.
- list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']
- ->invoke(null, 26, 9, 1, 0);
- $this->assertSame(9, $numDataBytes);
- $this->assertSame(17, $numEcBytes);
-
- // Version 3-H. 2 blocks.
- list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']
- ->invoke(null, 70, 26, 2, 0);
- $this->assertSame(13, $numDataBytes);
- $this->assertSame(22, $numEcBytes);
- list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']
- ->invoke(null, 70, 26, 2, 1);
- $this->assertSame(13, $numDataBytes);
- $this->assertSame(22, $numEcBytes);
-
- // Version 7-H. (4 + 1) blocks.
- list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']
- ->invoke(null, 196, 66, 5, 0);
- $this->assertSame(13, $numDataBytes);
- $this->assertSame(26, $numEcBytes);
- list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']
- ->invoke(null, 196, 66, 5, 4);
- $this->assertSame(14, $numDataBytes);
- $this->assertSame(26, $numEcBytes);
-
- // Version 40-H. (20 + 61) blocks.
- list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']
- ->invoke(null, 3706, 1276, 81, 0);
- $this->assertSame(15, $numDataBytes);
- $this->assertSame(30, $numEcBytes);
- list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']
- ->invoke(null, 3706, 1276, 81, 20);
- $this->assertSame(16, $numDataBytes);
- $this->assertSame(30, $numEcBytes);
- list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']
- ->invoke(null, 3706, 1276, 81, 80);
- $this->assertSame(16, $numDataBytes);
- $this->assertSame(30, $numEcBytes);
- }
-
- public function testInterleaveWithEcBytes() : void
- {
- $dataBytes = SplFixedArray::fromArray([32, 65, 205, 69, 41, 220, 46, 128, 236], false);
- $in = new BitArray();
-
- foreach ($dataBytes as $dataByte) {
- $in->appendBits($dataByte, 8);
- }
-
- $outBits = $this->methods['interleaveWithEcBytes']->invoke(null, $in, 26, 9, 1);
- $expected = SplFixedArray::fromArray([
- // Data bytes.
- 32, 65, 205, 69, 41, 220, 46, 128, 236,
- // Error correction bytes.
- 42, 159, 74, 221, 244, 169, 239, 150, 138, 70, 237, 85, 224, 96, 74, 219, 61,
- ], false);
-
- $out = $outBits->toBytes(0, count($expected));
-
- $this->assertEquals($expected, $out);
- }
-
- public function testAppendNumericBytes() : void
- {
- // 1 = 01 = 0001 in 4 bits.
- $bits = new BitArray();
- $this->methods['appendNumericBytes']->invoke(null, '1', $bits);
- $this->assertSame(' ...X', (string) $bits);
-
- // 12 = 0xc = 0001100 in 7 bits.
- $bits = new BitArray();
- $this->methods['appendNumericBytes']->invoke(null, '12', $bits);
- $this->assertSame(' ...XX..', (string) $bits);
-
- // 123 = 0x7b = 0001111011 in 10 bits.
- $bits = new BitArray();
- $this->methods['appendNumericBytes']->invoke(null, '123', $bits);
- $this->assertSame(' ...XXXX. XX', (string) $bits);
-
- // 1234 = "123" + "4" = 0001111011 + 0100 in 14 bits.
- $bits = new BitArray();
- $this->methods['appendNumericBytes']->invoke(null, '1234', $bits);
- $this->assertSame(' ...XXXX. XX.X..', (string) $bits);
-
- // Empty
- $bits = new BitArray();
- $this->methods['appendNumericBytes']->invoke(null, '', $bits);
- $this->assertSame('', (string) $bits);
- }
-
- public function testAppendAlphanumericBytes() : void
- {
- $bits = new BitArray();
- $this->methods['appendAlphanumericBytes']->invoke(null, 'A', $bits);
- $this->assertSame(' ..X.X.', (string) $bits);
-
- $bits = new BitArray();
- $this->methods['appendAlphanumericBytes']->invoke(null, 'AB', $bits);
- $this->assertSame(' ..XXX..X X.X', (string) $bits);
-
- $bits = new BitArray();
- $this->methods['appendAlphanumericBytes']->invoke(null, 'ABC', $bits);
- $this->assertSame(' ..XXX..X X.X..XX. .', (string) $bits);
-
- // Empty
- $bits = new BitArray();
- $this->methods['appendAlphanumericBytes']->invoke(null, '', $bits);
- $this->assertSame('', (string) $bits);
-
- // Invalid data
- $this->expectException(WriterException::class);
- $bits = new BitArray();
- $this->methods['appendAlphanumericBytes']->invoke(null, 'abc', $bits);
- }
-
- public function testAppend8BitBytes() : void
- {
- // 0x61, 0x62, 0x63
- $bits = new BitArray();
- $this->methods['append8BitBytes']->invoke(null, 'abc', $bits, Encoder::DEFAULT_BYTE_MODE_ECODING);
- $this->assertSame(' .XX....X .XX...X. .XX...XX', (string) $bits);
-
- // Empty
- $bits = new BitArray();
- $this->methods['append8BitBytes']->invoke(null, '', $bits, Encoder::DEFAULT_BYTE_MODE_ECODING);
- $this->assertSame('', (string) $bits);
- }
-
- public function testAppendKanjiBytes() : void
- {
- // Numbers are from page 21 of JISX0510:2004
- $bits = new BitArray();
- $this->methods['appendKanjiBytes']->invoke(null, "\x93\x5f", $bits);
- $this->assertSame(' .XX.XX.. XXXXX', (string) $bits);
-
- $this->methods['appendKanjiBytes']->invoke(null, "\xe4\xaa", $bits);
- $this->assertSame(' .XX.XX.. XXXXXXX. X.X.X.X. X.', (string) $bits);
- }
-
- public function testGenerateEcBytes() : void
- {
- // Numbers are from http://www.swetake.com/qr/qr3.html and
- // http://www.swetake.com/qr/qr9.html
- $dataBytes = SplFixedArray::fromArray([32, 65, 205, 69, 41, 220, 46, 128, 236], false);
- $ecBytes = $this->methods['generateEcBytes']->invoke(null, $dataBytes, 17);
- $expected = SplFixedArray::fromArray(
- [42, 159, 74, 221, 244, 169, 239, 150, 138, 70, 237, 85, 224, 96, 74, 219, 61],
- false
- );
- $this->assertEquals($expected, $ecBytes);
-
- $dataBytes = SplFixedArray::fromArray(
- [67, 70, 22, 38, 54, 70, 86, 102, 118, 134, 150, 166, 182, 198, 214],
- false
- );
- $ecBytes = $this->methods['generateEcBytes']->invoke(null, $dataBytes, 18);
- $expected = SplFixedArray::fromArray(
- [175, 80, 155, 64, 178, 45, 214, 233, 65, 209, 12, 155, 117, 31, 140, 214, 27, 187],
- false
- );
- $this->assertEquals($expected, $ecBytes);
-
- // High-order zero coefficient case.
- $dataBytes = SplFixedArray::fromArray([32, 49, 205, 69, 42, 20, 0, 236, 17], false);
- $ecBytes = $this->methods['generateEcBytes']->invoke(null, $dataBytes, 17);
- $expected = SplFixedArray::fromArray(
- [0, 3, 130, 179, 194, 0, 55, 211, 110, 79, 98, 72, 170, 96, 211, 137, 213],
- false
- );
- $this->assertEquals($expected, $ecBytes);
- }
-}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/test/Encoder/MaskUtilTest.php b/thirdparty/vendor/bacon/bacon-qr-code/test/Encoder/MaskUtilTest.php
deleted file mode 100644
index 46670fc..0000000
--- a/thirdparty/vendor/bacon/bacon-qr-code/test/Encoder/MaskUtilTest.php
+++ /dev/null
@@ -1,251 +0,0 @@
-assertSame(
- 1 === $expected[$y][$x],
- MaskUtil::getDataMaskBit($maskPattern, $x, $y)
- );
- }
- }
- }
-
- public function testApplyMaskPenaltyRule1() : void
- {
- $matrix = new ByteMatrix(4, 1);
- $matrix->set(0, 0, 0);
- $matrix->set(1, 0, 0);
- $matrix->set(2, 0, 0);
- $matrix->set(3, 0, 0);
-
- $this->assertSame(0, MaskUtil::applyMaskPenaltyRule1($matrix));
-
- // Horizontal
- $matrix = new ByteMatrix(6, 1);
- $matrix->set(0, 0, 0);
- $matrix->set(1, 0, 0);
- $matrix->set(2, 0, 0);
- $matrix->set(3, 0, 0);
- $matrix->set(4, 0, 0);
- $matrix->set(5, 0, 1);
- $this->assertSame(3, MaskUtil::applyMaskPenaltyRule1($matrix));
- $matrix->set(5, 0, 0);
- $this->assertSame(4, MaskUtil::applyMaskPenaltyRule1($matrix));
-
- // Vertical
- $matrix = new ByteMatrix(1, 6);
- $matrix->set(0, 0, 0);
- $matrix->set(0, 1, 0);
- $matrix->set(0, 2, 0);
- $matrix->set(0, 3, 0);
- $matrix->set(0, 4, 0);
- $matrix->set(0, 5, 1);
- $this->assertSame(3, MaskUtil::applyMaskPenaltyRule1($matrix));
- $matrix->set(0, 5, 0);
- $this->assertSame(4, MaskUtil::applyMaskPenaltyRule1($matrix));
- }
-
- public function testApplyMaskPenaltyRule2() : void
- {
- $matrix = new ByteMatrix(1, 1);
- $matrix->set(0, 0, 0);
- $this->assertSame(0, MaskUtil::applyMaskPenaltyRule2($matrix));
-
- $matrix = new ByteMatrix(2, 2);
- $matrix->set(0, 0, 0);
- $matrix->set(1, 0, 0);
- $matrix->set(0, 1, 0);
- $matrix->set(1, 1, 1);
- $this->assertSame(0, MaskUtil::applyMaskPenaltyRule2($matrix));
-
- $matrix = new ByteMatrix(2, 2);
- $matrix->set(0, 0, 0);
- $matrix->set(1, 0, 0);
- $matrix->set(0, 1, 0);
- $matrix->set(1, 1, 0);
- $this->assertSame(3, MaskUtil::applyMaskPenaltyRule2($matrix));
-
- $matrix = new ByteMatrix(3, 3);
- $matrix->set(0, 0, 0);
- $matrix->set(1, 0, 0);
- $matrix->set(2, 0, 0);
- $matrix->set(0, 1, 0);
- $matrix->set(1, 1, 0);
- $matrix->set(2, 1, 0);
- $matrix->set(0, 2, 0);
- $matrix->set(1, 2, 0);
- $matrix->set(2, 2, 0);
- $this->assertSame(3 * 4, MaskUtil::applyMaskPenaltyRule2($matrix));
- }
-
- public function testApplyMaskPenalty3() : void
- {
- // Horizontal 00001011101
- $matrix = new ByteMatrix(11, 1);
- $matrix->set(0, 0, 0);
- $matrix->set(1, 0, 0);
- $matrix->set(2, 0, 0);
- $matrix->set(3, 0, 0);
- $matrix->set(4, 0, 1);
- $matrix->set(5, 0, 0);
- $matrix->set(6, 0, 1);
- $matrix->set(7, 0, 1);
- $matrix->set(8, 0, 1);
- $matrix->set(9, 0, 0);
- $matrix->set(10, 0, 1);
- $this->assertSame(40, MaskUtil::applyMaskPenaltyRule3($matrix));
-
- // Horizontal 10111010000
- $matrix = new ByteMatrix(11, 1);
- $matrix->set(0, 0, 1);
- $matrix->set(1, 0, 0);
- $matrix->set(2, 0, 1);
- $matrix->set(3, 0, 1);
- $matrix->set(4, 0, 1);
- $matrix->set(5, 0, 0);
- $matrix->set(6, 0, 1);
- $matrix->set(7, 0, 0);
- $matrix->set(8, 0, 0);
- $matrix->set(9, 0, 0);
- $matrix->set(10, 0, 0);
- $this->assertSame(40, MaskUtil::applyMaskPenaltyRule3($matrix));
-
- // Vertical 00001011101
- $matrix = new ByteMatrix(1, 11);
- $matrix->set(0, 0, 0);
- $matrix->set(0, 1, 0);
- $matrix->set(0, 2, 0);
- $matrix->set(0, 3, 0);
- $matrix->set(0, 4, 1);
- $matrix->set(0, 5, 0);
- $matrix->set(0, 6, 1);
- $matrix->set(0, 7, 1);
- $matrix->set(0, 8, 1);
- $matrix->set(0, 9, 0);
- $matrix->set(0, 10, 1);
- $this->assertSame(40, MaskUtil::applyMaskPenaltyRule3($matrix));
-
- // Vertical 10111010000
- $matrix = new ByteMatrix(1, 11);
- $matrix->set(0, 0, 1);
- $matrix->set(0, 1, 0);
- $matrix->set(0, 2, 1);
- $matrix->set(0, 3, 1);
- $matrix->set(0, 4, 1);
- $matrix->set(0, 5, 0);
- $matrix->set(0, 6, 1);
- $matrix->set(0, 7, 0);
- $matrix->set(0, 8, 0);
- $matrix->set(0, 9, 0);
- $matrix->set(0, 10, 0);
- $this->assertSame(40, MaskUtil::applyMaskPenaltyRule3($matrix));
- }
-
- public function testApplyMaskPenaltyRule4() : void
- {
- // Dark cell ratio = 0%
- $matrix = new ByteMatrix(1, 1);
- $matrix->set(0, 0, 0);
- $this->assertSame(100, MaskUtil::applyMaskPenaltyRule4($matrix));
-
- // Dark cell ratio = 5%
- $matrix = new ByteMatrix(2, 1);
- $matrix->set(0, 0, 0);
- $matrix->set(0, 0, 1);
- $this->assertSame(0, MaskUtil::applyMaskPenaltyRule4($matrix));
-
- // Dark cell ratio = 66.67%
- $matrix = new ByteMatrix(6, 1);
- $matrix->set(0, 0, 0);
- $matrix->set(1, 0, 1);
- $matrix->set(2, 0, 1);
- $matrix->set(3, 0, 1);
- $matrix->set(4, 0, 1);
- $matrix->set(5, 0, 0);
- $this->assertSame(30, MaskUtil::applyMaskPenaltyRule4($matrix));
- }
-}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/test/Encoder/MatrixUtilTest.php b/thirdparty/vendor/bacon/bacon-qr-code/test/Encoder/MatrixUtilTest.php
deleted file mode 100644
index 106ceaa..0000000
--- a/thirdparty/vendor/bacon/bacon-qr-code/test/Encoder/MatrixUtilTest.php
+++ /dev/null
@@ -1,335 +0,0 @@
-getMethods(ReflectionMethod::IS_STATIC) as $method) {
- $method->setAccessible(true);
- $this->methods[$method->getName()] = $method;
- }
- }
-
- public function testToString() : void
- {
- $matrix = new ByteMatrix(3, 3);
- $matrix->set(0, 0, 0);
- $matrix->set(1, 0, 1);
- $matrix->set(2, 0, 0);
- $matrix->set(0, 1, 1);
- $matrix->set(1, 1, 0);
- $matrix->set(2, 1, 1);
- $matrix->set(0, 2, -1);
- $matrix->set(1, 2, -1);
- $matrix->set(2, 2, -1);
-
- $expected = " 0 1 0\n 1 0 1\n \n";
- $this->assertSame($expected, (string) $matrix);
- }
-
- public function testClearMatrix() : void
- {
- $matrix = new ByteMatrix(2, 2);
- MatrixUtil::clearMatrix($matrix);
-
- $this->assertSame(-1, $matrix->get(0, 0));
- $this->assertSame(-1, $matrix->get(1, 0));
- $this->assertSame(-1, $matrix->get(0, 1));
- $this->assertSame(-1, $matrix->get(1, 1));
- }
-
- public function testEmbedBasicPatterns1() : void
- {
- $matrix = new ByteMatrix(21, 21);
- MatrixUtil::clearMatrix($matrix);
- $this->methods['embedBasicPatterns']->invoke(
- null,
- Version::getVersionForNumber(1),
- $matrix
- );
- $expected = " 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1\n"
- . " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n"
- . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n"
- . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n"
- . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n"
- . " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n"
- . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n"
- . " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
- . " 1 \n"
- . " 0 \n"
- . " 1 \n"
- . " 0 \n"
- . " 1 \n"
- . " 0 0 0 0 0 0 0 0 1 \n"
- . " 1 1 1 1 1 1 1 0 \n"
- . " 1 0 0 0 0 0 1 0 \n"
- . " 1 0 1 1 1 0 1 0 \n"
- . " 1 0 1 1 1 0 1 0 \n"
- . " 1 0 1 1 1 0 1 0 \n"
- . " 1 0 0 0 0 0 1 0 \n"
- . " 1 1 1 1 1 1 1 0 \n";
-
- $this->assertSame($expected, (string) $matrix);
- }
-
- public function testEmbedBasicPatterns2() : void
- {
- $matrix = new ByteMatrix(25, 25);
- MatrixUtil::clearMatrix($matrix);
- $this->methods['embedBasicPatterns']->invoke(
- null,
- Version::getVersionForNumber(2),
- $matrix
- );
- $expected = " 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1\n"
- . " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n"
- . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n"
- . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n"
- . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n"
- . " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n"
- . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n"
- . " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
- . " 1 \n"
- . " 0 \n"
- . " 1 \n"
- . " 0 \n"
- . " 1 \n"
- . " 0 \n"
- . " 1 \n"
- . " 0 \n"
- . " 1 1 1 1 1 1 \n"
- . " 0 0 0 0 0 0 0 0 1 1 0 0 0 1 \n"
- . " 1 1 1 1 1 1 1 0 1 0 1 0 1 \n"
- . " 1 0 0 0 0 0 1 0 1 0 0 0 1 \n"
- . " 1 0 1 1 1 0 1 0 1 1 1 1 1 \n"
- . " 1 0 1 1 1 0 1 0 \n"
- . " 1 0 1 1 1 0 1 0 \n"
- . " 1 0 0 0 0 0 1 0 \n"
- . " 1 1 1 1 1 1 1 0 \n";
-
- $this->assertSame($expected, (string) $matrix);
- }
-
- public function testEmbedTypeInfo() : void
- {
- $matrix = new ByteMatrix(21, 21);
- MatrixUtil::clearMatrix($matrix);
- $this->methods['embedTypeInfo']->invoke(
- null,
- ErrorCorrectionLevel::M(),
- 5,
- $matrix
- );
- $expected = " 0 \n"
- . " 1 \n"
- . " 1 \n"
- . " 1 \n"
- . " 0 \n"
- . " 0 \n"
- . " \n"
- . " 1 \n"
- . " 1 0 0 0 0 0 0 1 1 1 0 0 1 1 1 0\n"
- . " \n"
- . " \n"
- . " \n"
- . " \n"
- . " \n"
- . " 0 \n"
- . " 0 \n"
- . " 0 \n"
- . " 0 \n"
- . " 0 \n"
- . " 0 \n"
- . " 1 \n";
-
- $this->assertSame($expected, (string) $matrix);
- }
-
- public function testEmbedVersionInfo() : void
- {
- $matrix = new ByteMatrix(21, 21);
- MatrixUtil::clearMatrix($matrix);
- $this->methods['maybeEmbedVersionInfo']->invoke(
- null,
- Version::getVersionForNumber(7),
- $matrix
- );
- $expected = " 0 0 1 \n"
- . " 0 1 0 \n"
- . " 0 1 0 \n"
- . " 0 1 1 \n"
- . " 1 1 1 \n"
- . " 0 0 0 \n"
- . " \n"
- . " \n"
- . " \n"
- . " \n"
- . " 0 0 0 0 1 0 \n"
- . " 0 1 1 1 1 0 \n"
- . " 1 0 0 1 1 0 \n"
- . " \n"
- . " \n"
- . " \n"
- . " \n"
- . " \n"
- . " \n"
- . " \n"
- . " \n";
-
- $this->assertSame($expected, (string) $matrix);
- }
-
- public function testEmbedDataBits() : void
- {
- $matrix = new ByteMatrix(21, 21);
- MatrixUtil::clearMatrix($matrix);
- $this->methods['embedBasicPatterns']->invoke(
- null,
- Version::getVersionForNumber(1),
- $matrix
- );
-
- $bits = new BitArray();
- $this->methods['embedDataBits']->invoke(
- null,
- $bits,
- -1,
- $matrix
- );
-
- $expected = " 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1\n"
- . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1\n"
- . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1\n"
- . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1\n"
- . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1\n"
- . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1\n"
- . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n"
- . " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
- . " 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
- . " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
- . " 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
- . " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
- . " 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
- . " 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0\n"
- . " 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
- . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
- . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
- . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
- . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
- . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
- . " 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n";
-
- $this->assertSame($expected, (string) $matrix);
- }
-
- public function testBuildMatrix() : void
- {
- $bytes = [
- 32, 65, 205, 69, 41, 220, 46, 128, 236, 42, 159, 74, 221, 244, 169,
- 239, 150, 138, 70, 237, 85, 224, 96, 74, 219 , 61
- ];
- $bits = new BitArray();
-
- foreach ($bytes as $byte) {
- $bits->appendBits($byte, 8);
- }
-
- $matrix = new ByteMatrix(21, 21);
- MatrixUtil::buildMatrix(
- $bits,
- ErrorCorrectionLevel::H(),
- Version::getVersionForNumber(1),
- 3,
- $matrix
- );
-
- $expected = " 1 1 1 1 1 1 1 0 0 1 1 0 0 0 1 1 1 1 1 1 1\n"
- . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1\n"
- . " 1 0 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 1 1 0 1\n"
- . " 1 0 1 1 1 0 1 0 0 1 1 0 0 0 1 0 1 1 1 0 1\n"
- . " 1 0 1 1 1 0 1 0 1 1 0 0 1 0 1 0 1 1 1 0 1\n"
- . " 1 0 0 0 0 0 1 0 0 0 1 1 1 0 1 0 0 0 0 0 1\n"
- . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n"
- . " 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0\n"
- . " 0 0 1 1 0 0 1 1 1 0 0 1 1 1 1 0 1 0 0 0 0\n"
- . " 1 0 1 0 1 0 0 0 0 0 1 1 1 0 0 1 0 1 1 1 0\n"
- . " 1 1 1 1 0 1 1 0 1 0 1 1 1 0 0 1 1 1 0 1 0\n"
- . " 1 0 1 0 1 1 0 1 1 1 0 0 1 1 1 0 0 1 0 1 0\n"
- . " 0 0 1 0 0 1 1 1 0 0 0 0 0 0 1 0 1 1 1 1 1\n"
- . " 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 1 1\n"
- . " 1 1 1 1 1 1 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0\n"
- . " 1 0 0 0 0 0 1 0 0 0 0 1 0 1 1 1 0 0 0 0 0\n"
- . " 1 0 1 1 1 0 1 0 0 1 0 0 1 1 0 0 1 0 0 1 1\n"
- . " 1 0 1 1 1 0 1 0 1 1 0 1 0 0 0 0 0 1 1 1 0\n"
- . " 1 0 1 1 1 0 1 0 1 1 1 1 0 0 0 0 1 1 1 0 0\n"
- . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0\n"
- . " 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 0 1 0 0 1 0\n";
-
- $this->assertSame($expected, (string) $matrix);
- }
-
- public function testFindMsbSet() : void
- {
- $this->assertSame(0, $this->methods['findMsbSet']->invoke(null, 0));
- $this->assertSame(1, $this->methods['findMsbSet']->invoke(null, 1));
- $this->assertSame(8, $this->methods['findMsbSet']->invoke(null, 0x80));
- $this->assertSame(32, $this->methods['findMsbSet']->invoke(null, 0x80000000));
- }
-
- public function testCalculateBchCode() : void
- {
- // Encoding of type information.
- // From Appendix C in JISX0510:2004 (p 65)
- $this->assertSame(0xdc, $this->methods['calculateBchCode']->invoke(null, 5, 0x537));
- // From http://www.swetake.com/qr/qr6.html
- $this->assertSame(0x1c2, $this->methods['calculateBchCode']->invoke(null, 0x13, 0x537));
- // From http://www.swetake.com/qr/qr11.html
- $this->assertSame(0x214, $this->methods['calculateBchCode']->invoke(null, 0x1b, 0x537));
-
- // Encoding of version information.
- // From Appendix D in JISX0510:2004 (p 68)
- $this->assertSame(0xc94, $this->methods['calculateBchCode']->invoke(null, 7, 0x1f25));
- $this->assertSame(0x5bc, $this->methods['calculateBchCode']->invoke(null, 8, 0x1f25));
- $this->assertSame(0xa99, $this->methods['calculateBchCode']->invoke(null, 9, 0x1f25));
- $this->assertSame(0x4d3, $this->methods['calculateBchCode']->invoke(null, 10, 0x1f25));
- $this->assertSame(0x9a6, $this->methods['calculateBchCode']->invoke(null, 20, 0x1f25));
- $this->assertSame(0xd75, $this->methods['calculateBchCode']->invoke(null, 30, 0x1f25));
- $this->assertSame(0xc69, $this->methods['calculateBchCode']->invoke(null, 40, 0x1f25));
- }
-
- public function testMakeVersionInfoBits() : void
- {
- // From Appendix D in JISX0510:2004 (p 68)
- $bits = new BitArray();
- $this->methods['makeVersionInfoBits']->invoke(null, Version::getVersionForNumber(7), $bits);
- $this->assertSame(' ...XXXXX ..X..X.X ..', (string) $bits);
- }
-
- public function testMakeTypeInfoBits() : void
- {
- // From Appendix D in JISX0510:2004 (p 68)
- $bits = new BitArray();
- $this->methods['makeTypeInfoBits']->invoke(null, ErrorCorrectionLevel::M(), 5, $bits);
- $this->assertSame(' X......X X..XXX.', (string) $bits);
- }
-}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/test/Integration/ImagickRenderingTest.php b/thirdparty/vendor/bacon/bacon-qr-code/test/Integration/ImagickRenderingTest.php
deleted file mode 100644
index 3df8687..0000000
--- a/thirdparty/vendor/bacon/bacon-qr-code/test/Integration/ImagickRenderingTest.php
+++ /dev/null
@@ -1,72 +0,0 @@
-writeFile('Hello World!', $tempName);
-
- $this->assertMatchesFileSnapshot($tempName);
- unlink($tempName);
- }
-
- /**
- * @requires extension imagick
- */
- public function testIssue79() : void
- {
- $eye = SquareEye::instance();
- $squareModule = SquareModule::instance();
-
- $eyeFill = new EyeFill(new Rgb(100, 100, 55), new Rgb(100, 100, 255));
- $gradient = new Gradient(new Rgb(100, 100, 55), new Rgb(100, 100, 255), GradientType::HORIZONTAL());
-
- $renderer = new ImageRenderer(
- new RendererStyle(
- 400,
- 2,
- $squareModule,
- $eye,
- Fill::withForegroundGradient(new Rgb(255, 255, 255), $gradient, $eyeFill, $eyeFill, $eyeFill)
- ),
- new ImagickImageBackEnd()
- );
- $writer = new Writer($renderer);
- $tempName = tempnam(sys_get_temp_dir(), 'test') . '.png';
- $writer->writeFile('https://apiroad.net/very-long-url', $tempName);
-
- $this->assertMatchesFileSnapshot($tempName);
- unlink($tempName);
- }
-}
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/test/Integration/__snapshots__/files/ImagickRenderingTest__testGenericQrCode__1.png b/thirdparty/vendor/bacon/bacon-qr-code/test/Integration/__snapshots__/files/ImagickRenderingTest__testGenericQrCode__1.png
deleted file mode 100644
index 9a429ed..0000000
Binary files a/thirdparty/vendor/bacon/bacon-qr-code/test/Integration/__snapshots__/files/ImagickRenderingTest__testGenericQrCode__1.png and /dev/null differ
diff --git a/thirdparty/vendor/bacon/bacon-qr-code/test/Integration/__snapshots__/files/ImagickRenderingTest__testIssue79__1.png b/thirdparty/vendor/bacon/bacon-qr-code/test/Integration/__snapshots__/files/ImagickRenderingTest__testIssue79__1.png
deleted file mode 100644
index 47e3b1a..0000000
Binary files a/thirdparty/vendor/bacon/bacon-qr-code/test/Integration/__snapshots__/files/ImagickRenderingTest__testIssue79__1.png and /dev/null differ
diff --git a/thirdparty/vendor/composer/LICENSE b/thirdparty/vendor/composer/LICENSE
index f27399a..62ecfd8 100644
--- a/thirdparty/vendor/composer/LICENSE
+++ b/thirdparty/vendor/composer/LICENSE
@@ -1,4 +1,3 @@
-
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -18,4 +17,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-
diff --git a/thirdparty/vendor/composer/installed.json b/thirdparty/vendor/composer/installed.json
index 5a966b5..9941944 100644
--- a/thirdparty/vendor/composer/installed.json
+++ b/thirdparty/vendor/composer/installed.json
@@ -2,34 +2,34 @@
"packages": [
{
"name": "bacon/bacon-qr-code",
- "version": "2.0.8",
- "version_normalized": "2.0.8.0",
+ "version": "v3.0.1",
+ "version_normalized": "3.0.1.0",
"source": {
"type": "git",
"url": "https://github.com/Bacon/BaconQrCode.git",
- "reference": "8674e51bb65af933a5ffaf1c308a660387c35c22"
+ "reference": "f9cc1f52b5a463062251d666761178dbdb6b544f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/8674e51bb65af933a5ffaf1c308a660387c35c22",
- "reference": "8674e51bb65af933a5ffaf1c308a660387c35c22",
+ "url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/f9cc1f52b5a463062251d666761178dbdb6b544f",
+ "reference": "f9cc1f52b5a463062251d666761178dbdb6b544f",
"shasum": ""
},
"require": {
"dasprid/enum": "^1.0.3",
"ext-iconv": "*",
- "php": "^7.1 || ^8.0"
+ "php": "^8.1"
},
"require-dev": {
- "phly/keep-a-changelog": "^2.1",
- "phpunit/phpunit": "^7 | ^8 | ^9",
- "spatie/phpunit-snapshot-assertions": "^4.2.9",
- "squizlabs/php_codesniffer": "^3.4"
+ "phly/keep-a-changelog": "^2.12",
+ "phpunit/phpunit": "^10.5.11 || 11.0.4",
+ "spatie/phpunit-snapshot-assertions": "^5.1.5",
+ "squizlabs/php_codesniffer": "^3.9"
},
"suggest": {
"ext-imagick": "to generate QR code images"
},
- "time": "2022-12-07T17:46:57+00:00",
+ "time": "2024-10-01T13:55:55+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@@ -53,23 +53,23 @@
"homepage": "https://github.com/Bacon/BaconQrCode",
"support": {
"issues": "https://github.com/Bacon/BaconQrCode/issues",
- "source": "https://github.com/Bacon/BaconQrCode/tree/2.0.8"
+ "source": "https://github.com/Bacon/BaconQrCode/tree/v3.0.1"
},
"install-path": "../bacon/bacon-qr-code"
},
{
"name": "dasprid/enum",
- "version": "1.0.6",
- "version_normalized": "1.0.6.0",
+ "version": "1.0.7",
+ "version_normalized": "1.0.7.0",
"source": {
"type": "git",
"url": "https://github.com/DASPRiD/Enum.git",
- "reference": "8dfd07c6d2cf31c8da90c53b83c026c7696dda90"
+ "reference": "b5874fa9ed0043116c72162ec7f4fb50e02e7cce"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/DASPRiD/Enum/zipball/8dfd07c6d2cf31c8da90c53b83c026c7696dda90",
- "reference": "8dfd07c6d2cf31c8da90c53b83c026c7696dda90",
+ "url": "https://api.github.com/repos/DASPRiD/Enum/zipball/b5874fa9ed0043116c72162ec7f4fb50e02e7cce",
+ "reference": "b5874fa9ed0043116c72162ec7f4fb50e02e7cce",
"shasum": ""
},
"require": {
@@ -79,7 +79,7 @@
"phpunit/phpunit": "^7 || ^8 || ^9 || ^10 || ^11",
"squizlabs/php_codesniffer": "*"
},
- "time": "2024-08-09T14:30:48+00:00",
+ "time": "2025-09-16T12:23:56+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@@ -106,33 +106,33 @@
],
"support": {
"issues": "https://github.com/DASPRiD/Enum/issues",
- "source": "https://github.com/DASPRiD/Enum/tree/1.0.6"
+ "source": "https://github.com/DASPRiD/Enum/tree/1.0.7"
},
"install-path": "../dasprid/enum"
},
{
"name": "endroid/qr-code",
- "version": "4.6.1",
- "version_normalized": "4.6.1.0",
+ "version": "6.0.0",
+ "version_normalized": "6.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/endroid/qr-code.git",
- "reference": "a75c913b0e4d6ad275e49a2c1de1cacffc6c2184"
+ "reference": "61cc3ef6863936b58e0cbe63a44da79efe3c84cd"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/endroid/qr-code/zipball/a75c913b0e4d6ad275e49a2c1de1cacffc6c2184",
- "reference": "a75c913b0e4d6ad275e49a2c1de1cacffc6c2184",
+ "url": "https://api.github.com/repos/endroid/qr-code/zipball/61cc3ef6863936b58e0cbe63a44da79efe3c84cd",
+ "reference": "61cc3ef6863936b58e0cbe63a44da79efe3c84cd",
"shasum": ""
},
"require": {
- "bacon/bacon-qr-code": "^2.0.5",
- "php": "^7.4||^8.0"
+ "bacon/bacon-qr-code": "^3.0",
+ "php": "^8.2"
},
"require-dev": {
- "endroid/quality": "dev-master",
+ "endroid/quality": "dev-main",
"ext-gd": "*",
- "khanamiryan/qrcode-detector-decoder": "^1.0.4",
+ "khanamiryan/qrcode-detector-decoder": "^2.0.2",
"setasign/fpdf": "^1.8.2"
},
"suggest": {
@@ -141,11 +141,11 @@
"roave/security-advisories": "Makes sure package versions with known security issues are not installed",
"setasign/fpdf": "Enables you to use the PDF writer"
},
- "time": "2022-10-26T08:48:17+00:00",
+ "time": "2024-10-21T20:26:43+00:00",
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "4.x-dev"
+ "dev-main": "6.x-dev"
}
},
"installation-source": "dist",
@@ -175,7 +175,7 @@
],
"support": {
"issues": "https://github.com/endroid/qr-code/issues",
- "source": "https://github.com/endroid/qr-code/tree/4.6.1"
+ "source": "https://github.com/endroid/qr-code/tree/6.0.0"
},
"funding": [
{
diff --git a/thirdparty/vendor/composer/installed.php b/thirdparty/vendor/composer/installed.php
index 71000bb..14583d0 100644
--- a/thirdparty/vendor/composer/installed.php
+++ b/thirdparty/vendor/composer/installed.php
@@ -1,9 +1,9 @@
array(
'name' => '__root__',
- 'pretty_version' => 'dev-master',
- 'version' => 'dev-master',
- 'reference' => '9cc7faa88c53194853e176534e620166b5706f41',
+ 'pretty_version' => 'dev-main',
+ 'version' => 'dev-main',
+ 'reference' => 'd3cccf10f0160f9f2c4aa34e4cca02813ee16dac',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -11,36 +11,36 @@
),
'versions' => array(
'__root__' => array(
- 'pretty_version' => 'dev-master',
- 'version' => 'dev-master',
- 'reference' => '9cc7faa88c53194853e176534e620166b5706f41',
+ 'pretty_version' => 'dev-main',
+ 'version' => 'dev-main',
+ 'reference' => 'd3cccf10f0160f9f2c4aa34e4cca02813ee16dac',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
'bacon/bacon-qr-code' => array(
- 'pretty_version' => '2.0.8',
- 'version' => '2.0.8.0',
- 'reference' => '8674e51bb65af933a5ffaf1c308a660387c35c22',
+ 'pretty_version' => 'v3.0.1',
+ 'version' => '3.0.1.0',
+ 'reference' => 'f9cc1f52b5a463062251d666761178dbdb6b544f',
'type' => 'library',
'install_path' => __DIR__ . '/../bacon/bacon-qr-code',
'aliases' => array(),
'dev_requirement' => false,
),
'dasprid/enum' => array(
- 'pretty_version' => '1.0.6',
- 'version' => '1.0.6.0',
- 'reference' => '8dfd07c6d2cf31c8da90c53b83c026c7696dda90',
+ 'pretty_version' => '1.0.7',
+ 'version' => '1.0.7.0',
+ 'reference' => 'b5874fa9ed0043116c72162ec7f4fb50e02e7cce',
'type' => 'library',
'install_path' => __DIR__ . '/../dasprid/enum',
'aliases' => array(),
'dev_requirement' => false,
),
'endroid/qr-code' => array(
- 'pretty_version' => '4.6.1',
- 'version' => '4.6.1.0',
- 'reference' => 'a75c913b0e4d6ad275e49a2c1de1cacffc6c2184',
+ 'pretty_version' => '6.0.0',
+ 'version' => '6.0.0.0',
+ 'reference' => '61cc3ef6863936b58e0cbe63a44da79efe3c84cd',
'type' => 'library',
'install_path' => __DIR__ . '/../endroid/qr-code',
'aliases' => array(),
diff --git a/thirdparty/vendor/composer/platform_check.php b/thirdparty/vendor/composer/platform_check.php
index 580fa96..d32d90c 100644
--- a/thirdparty/vendor/composer/platform_check.php
+++ b/thirdparty/vendor/composer/platform_check.php
@@ -4,8 +4,8 @@
$issues = array();
-if (!(PHP_VERSION_ID >= 70400)) {
- $issues[] = 'Your Composer dependencies require a PHP version ">= 7.4.0". You are running ' . PHP_VERSION . '.';
+if (!(PHP_VERSION_ID >= 80200)) {
+ $issues[] = 'Your Composer dependencies require a PHP version ">= 8.2.0". You are running ' . PHP_VERSION . '.';
}
if ($issues) {
diff --git a/thirdparty/vendor/dasprid/enum/src/AbstractEnum.php b/thirdparty/vendor/dasprid/enum/src/AbstractEnum.php
index 79fe81c..43006dc 100644
--- a/thirdparty/vendor/dasprid/enum/src/AbstractEnum.php
+++ b/thirdparty/vendor/dasprid/enum/src/AbstractEnum.php
@@ -219,6 +219,16 @@ final public function __sleep() : array
throw new SerializeNotSupportedException();
}
+ /**
+ * Forbid serializing enums.
+ *
+ * @throws SerializeNotSupportedException
+ */
+ final public function __serialize() : array
+ {
+ throw new SerializeNotSupportedException();
+ }
+
/**
* Forbid unserializing enums.
*
@@ -229,6 +239,16 @@ final public function __wakeup() : void
throw new UnserializeNotSupportedException();
}
+ /**
+ * Forbid unserializing enums.
+ *
+ * @throws UnserializeNotSupportedException
+ */
+ final public function __unserialize($arg) : void
+ {
+ throw new UnserializeNotSupportedException();
+ }
+
/**
* Turns the enum into a string representation.
*
diff --git a/thirdparty/vendor/dasprid/enum/src/NullValue.php b/thirdparty/vendor/dasprid/enum/src/NullValue.php
index aff7608..848e9f0 100644
--- a/thirdparty/vendor/dasprid/enum/src/NullValue.php
+++ b/thirdparty/vendor/dasprid/enum/src/NullValue.php
@@ -43,6 +43,16 @@ final public function __sleep() : array
throw new SerializeNotSupportedException();
}
+ /**
+ * Forbid serializing enums.
+ *
+ * @throws SerializeNotSupportedException
+ */
+ final public function __serialize() : array
+ {
+ throw new SerializeNotSupportedException();
+ }
+
/**
* Forbid unserializing enums.
*
@@ -52,4 +62,14 @@ final public function __wakeup() : void
{
throw new UnserializeNotSupportedException();
}
+
+ /**
+ * Forbid unserializing enums.
+ *
+ * @throws UnserializeNotSupportedException
+ */
+ final public function __unserialize($arg) : void
+ {
+ throw new UnserializeNotSupportedException();
+ }
}
diff --git a/thirdparty/vendor/endroid/qr-code/.gitattributes b/thirdparty/vendor/endroid/qr-code/.gitattributes
deleted file mode 100644
index dbc5d83..0000000
--- a/thirdparty/vendor/endroid/qr-code/.gitattributes
+++ /dev/null
@@ -1,2 +0,0 @@
-/.github/workflows/ export-ignore
-/tests/ export-ignore
diff --git a/thirdparty/vendor/endroid/qr-code/.github/FUNDING.yml b/thirdparty/vendor/endroid/qr-code/.github/FUNDING.yml
deleted file mode 100644
index 7c0cb54..0000000
--- a/thirdparty/vendor/endroid/qr-code/.github/FUNDING.yml
+++ /dev/null
@@ -1 +0,0 @@
-github: endroid
diff --git a/thirdparty/vendor/endroid/qr-code/.gitignore b/thirdparty/vendor/endroid/qr-code/.gitignore
deleted file mode 100644
index 7ccd6d1..0000000
--- a/thirdparty/vendor/endroid/qr-code/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/composer
-/composer.lock
-/tests/coverage/
-/vendor/
diff --git a/thirdparty/vendor/endroid/qr-code/LICENSE b/thirdparty/vendor/endroid/qr-code/LICENSE
index 546d814..f7409e6 100644
--- a/thirdparty/vendor/endroid/qr-code/LICENSE
+++ b/thirdparty/vendor/endroid/qr-code/LICENSE
@@ -1,4 +1,4 @@
-Copyright 2022 (c) Jeroen van den Enden
+Copyright 2024 (c) Jeroen van den Enden
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/vendor/endroid/qr-code/README.md b/thirdparty/vendor/endroid/qr-code/README.md
index 79b9ee9..c648f0e 100644
--- a/thirdparty/vendor/endroid/qr-code/README.md
+++ b/thirdparty/vendor/endroid/qr-code/README.md
@@ -16,7 +16,7 @@ as PNG, SVG, EPS or in binary format.
## Sponsored by
-[](https://www.blackfire.io)
+[](https://www.blackfire.io)
## Installation
@@ -24,7 +24,7 @@ Use [Composer](https://getcomposer.org/) to install the library. Also make sure
[GD extension](https://www.php.net/manual/en/book.image.php) if you want to generate images.
``` bash
-$ composer require endroid/qr-code
+ composer require endroid/qr-code
```
## Usage: using the builder
@@ -32,27 +32,31 @@ $ composer require endroid/qr-code
```php
use Endroid\QrCode\Builder\Builder;
use Endroid\QrCode\Encoding\Encoding;
-use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelHigh;
-use Endroid\QrCode\Label\Alignment\LabelAlignmentCenter;
-use Endroid\QrCode\Label\Font\NotoSans;
-use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeMargin;
+use Endroid\QrCode\ErrorCorrectionLevel;
+use Endroid\QrCode\Label\LabelAlignment;
+use Endroid\QrCode\Label\Font\OpenSans;
+use Endroid\QrCode\RoundBlockSizeMode;
use Endroid\QrCode\Writer\PngWriter;
-$result = Builder::create()
- ->writer(new PngWriter())
- ->writerOptions([])
- ->data('Custom QR code contents')
- ->encoding(new Encoding('UTF-8'))
- ->errorCorrectionLevel(new ErrorCorrectionLevelHigh())
- ->size(300)
- ->margin(10)
- ->roundBlockSizeMode(new RoundBlockSizeModeMargin())
- ->logoPath(__DIR__.'/assets/symfony.png')
- ->labelText('This is the label')
- ->labelFont(new NotoSans(20))
- ->labelAlignment(new LabelAlignmentCenter())
- ->validateResult(false)
- ->build();
+$builder = new Builder(
+ writer: new PngWriter(),
+ writerOptions: [],
+ validateResult: false,
+ data: 'Custom QR code contents',
+ encoding: new Encoding('UTF-8'),
+ errorCorrectionLevel: ErrorCorrectionLevel::High,
+ size: 300,
+ margin: 10,
+ roundBlockSizeMode: RoundBlockSizeMode::Margin,
+ logoPath: __DIR__.'/assets/symfony.png',
+ logoResizeToWidth: 50,
+ logoPunchoutBackground: true,
+ labelText: 'This is the label',
+ labelFont: new OpenSans(20),
+ labelAlignment: LabelAlignment::Center
+);
+
+$result = $builder->build();
```
## Usage: without using the builder
@@ -60,33 +64,40 @@ $result = Builder::create()
```php
use Endroid\QrCode\Color\Color;
use Endroid\QrCode\Encoding\Encoding;
-use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelLow;
+use Endroid\QrCode\ErrorCorrectionLevel;
use Endroid\QrCode\QrCode;
use Endroid\QrCode\Label\Label;
use Endroid\QrCode\Logo\Logo;
-use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeMargin;
+use Endroid\QrCode\RoundBlockSizeMode;
use Endroid\QrCode\Writer\PngWriter;
use Endroid\QrCode\Writer\ValidationException;
$writer = new PngWriter();
// Create QR code
-$qrCode = QrCode::create('Life is too short to be generating QR codes')
- ->setEncoding(new Encoding('UTF-8'))
- ->setErrorCorrectionLevel(new ErrorCorrectionLevelLow())
- ->setSize(300)
- ->setMargin(10)
- ->setRoundBlockSizeMode(new RoundBlockSizeModeMargin())
- ->setForegroundColor(new Color(0, 0, 0))
- ->setBackgroundColor(new Color(255, 255, 255));
+$qrCode = new QrCode(
+ data: 'Life is too short to be generating QR codes',
+ encoding: new Encoding('UTF-8'),
+ errorCorrectionLevel: ErrorCorrectionLevel::Low,
+ size: 300,
+ margin: 10,
+ roundBlockSizeMode: RoundBlockSizeMode::Margin,
+ foregroundColor: new Color(0, 0, 0),
+ backgroundColor: new Color(255, 255, 255)
+);
// Create generic logo
-$logo = Logo::create(__DIR__.'/assets/symfony.png')
- ->setResizeToWidth(50);
+$logo = new Logo(
+ path: __DIR__.'/assets/symfony.png',
+ resizeToWidth: 50,
+ punchoutBackground: true
+);
// Create generic label
-$label = Label::create('Label')
- ->setTextColor(new Color(255, 0, 0));
+$label = new Label(
+ text: 'Label',
+ textColor: new Color(255, 0, 0)
+);
$result = $writer->write($qrCode, $logo, $label);
@@ -109,14 +120,38 @@ $result->saveToFile(__DIR__.'/qrcode.png');
$dataUri = $result->getDataUri();
```
-
+
### Writer options
+Some writers provide writer options. Each available writer option is can be
+found as a constant prefixed with WRITER_OPTION_ in the writer class.
+
+* `PdfWriter`
+ * `unit`: unit of measurement (default: mm)
+ * `fpdf`: PDF to place the image in (default: new PDF)
+ * `x`: image offset (default: 0)
+ * `y`: image offset (default: 0)
+ * `link`: a URL or an identifier returned by `AddLink()`.
+* `PngWriter`
+ * `compression_level`: compression level (0-9, default: -1 = zlib default)
+* `SvgWriter`
+ * `block_id`: id of the block element for external reference (default: block)
+ * `exclude_xml_declaration`: exclude XML declaration (default: false)
+ * `exclude_svg_width_and_height`: exclude width and height (default: false)
+ * `force_xlink_href`: forces xlink namespace in case of compatibility issues (default: false)
+ * `compact`: create using `path` element, otherwise use `defs` and `use` (default: true)
+* `WebPWriter`
+ * `quality`: image quality (0-100, default: 80)
+
+You can provide any writer options like this.
+
```php
use Endroid\QrCode\Writer\SvgWriter;
-$builder->setWriterOptions([SvgWriter::WRITER_OPTION_EXCLUDE_XML_DECLARATION => true]);
+$builder->writerOptions([
+ SvgWriter::WRITER_OPTION_EXCLUDE_XML_DECLARATION => true
+]);
```
### Encoding
@@ -172,7 +207,7 @@ integrates the QR code library in Symfony for an even better experience.
* Support for multiple configurations and injection via aliases
* Generate QR codes for defined configurations via URL like /qr-code//Hello
* Generate QR codes or URLs directly from Twig using dedicated functions
-
+
Read the [bundle documentation](https://github.com/endroid/qr-code-bundle)
for more information.
diff --git a/thirdparty/vendor/endroid/qr-code/assets/blackfire.png b/thirdparty/vendor/endroid/qr-code/assets/blackfire.png
deleted file mode 100644
index bc378fd..0000000
Binary files a/thirdparty/vendor/endroid/qr-code/assets/blackfire.png and /dev/null differ
diff --git a/thirdparty/vendor/endroid/qr-code/assets/noto_sans.otf b/thirdparty/vendor/endroid/qr-code/assets/noto_sans.otf
deleted file mode 100644
index 296fbeb..0000000
Binary files a/thirdparty/vendor/endroid/qr-code/assets/noto_sans.otf and /dev/null differ
diff --git a/thirdparty/vendor/endroid/qr-code/composer.json b/thirdparty/vendor/endroid/qr-code/composer.json
index 9fd62c0..03a54d6 100644
--- a/thirdparty/vendor/endroid/qr-code/composer.json
+++ b/thirdparty/vendor/endroid/qr-code/composer.json
@@ -12,13 +12,13 @@
}
],
"require": {
- "php": "^7.4||^8.0",
- "bacon/bacon-qr-code": "^2.0.5"
+ "php": "^8.2",
+ "bacon/bacon-qr-code": "^3.0"
},
"require-dev": {
"ext-gd": "*",
- "endroid/quality": "dev-master",
- "khanamiryan/qrcode-detector-decoder": "^1.0.4",
+ "endroid/quality": "dev-main",
+ "khanamiryan/qrcode-detector-decoder": "^2.0.2",
"setasign/fpdf": "^1.8.2"
},
"suggest": {
@@ -41,11 +41,14 @@
"sort-packages": true,
"preferred-install": {
"endroid/*": "source"
+ },
+ "allow-plugins": {
+ "endroid/installer": true
}
},
"extra": {
"branch-alias": {
- "dev-master": "4.x-dev"
+ "dev-main": "6.x-dev"
}
}
}
diff --git a/thirdparty/vendor/endroid/qr-code/src/Bacon/ErrorCorrectionLevelConverter.php b/thirdparty/vendor/endroid/qr-code/src/Bacon/ErrorCorrectionLevelConverter.php
index 90f23e0..ae2be59 100644
--- a/thirdparty/vendor/endroid/qr-code/src/Bacon/ErrorCorrectionLevelConverter.php
+++ b/thirdparty/vendor/endroid/qr-code/src/Bacon/ErrorCorrectionLevelConverter.php
@@ -4,27 +4,18 @@
namespace Endroid\QrCode\Bacon;
-use BaconQrCode\Common\ErrorCorrectionLevel;
-use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelHigh;
-use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelInterface;
-use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelLow;
-use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelMedium;
-use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelQuartile;
+use BaconQrCode\Common\ErrorCorrectionLevel as BaconErrorCorrectionLevel;
+use Endroid\QrCode\ErrorCorrectionLevel;
-final class ErrorCorrectionLevelConverter
+final readonly class ErrorCorrectionLevelConverter
{
- public static function convertToBaconErrorCorrectionLevel(ErrorCorrectionLevelInterface $errorCorrectionLevel): ErrorCorrectionLevel
+ public static function convertToBaconErrorCorrectionLevel(ErrorCorrectionLevel $errorCorrectionLevel): BaconErrorCorrectionLevel
{
- if ($errorCorrectionLevel instanceof ErrorCorrectionLevelLow) {
- return ErrorCorrectionLevel::valueOf('L');
- } elseif ($errorCorrectionLevel instanceof ErrorCorrectionLevelMedium) {
- return ErrorCorrectionLevel::valueOf('M');
- } elseif ($errorCorrectionLevel instanceof ErrorCorrectionLevelQuartile) {
- return ErrorCorrectionLevel::valueOf('Q');
- } elseif ($errorCorrectionLevel instanceof ErrorCorrectionLevelHigh) {
- return ErrorCorrectionLevel::valueOf('H');
- }
-
- throw new \Exception('Error correction level could not be converted');
+ return match ($errorCorrectionLevel) {
+ ErrorCorrectionLevel::Low => BaconErrorCorrectionLevel::valueOf('L'),
+ ErrorCorrectionLevel::Medium => BaconErrorCorrectionLevel::valueOf('M'),
+ ErrorCorrectionLevel::Quartile => BaconErrorCorrectionLevel::valueOf('Q'),
+ ErrorCorrectionLevel::High => BaconErrorCorrectionLevel::valueOf('H'),
+ };
}
}
diff --git a/thirdparty/vendor/endroid/qr-code/src/Bacon/MatrixFactory.php b/thirdparty/vendor/endroid/qr-code/src/Bacon/MatrixFactory.php
index 095b7be..1d6a9a2 100644
--- a/thirdparty/vendor/endroid/qr-code/src/Bacon/MatrixFactory.php
+++ b/thirdparty/vendor/endroid/qr-code/src/Bacon/MatrixFactory.php
@@ -10,7 +10,7 @@
use Endroid\QrCode\Matrix\MatrixInterface;
use Endroid\QrCode\QrCodeInterface;
-final class MatrixFactory implements MatrixFactoryInterface
+final readonly class MatrixFactory implements MatrixFactoryInterface
{
public function create(QrCodeInterface $qrCode): MatrixInterface
{
diff --git a/thirdparty/vendor/endroid/qr-code/src/Builder/Builder.php b/thirdparty/vendor/endroid/qr-code/src/Builder/Builder.php
index 63fd28b..07703a8 100644
--- a/thirdparty/vendor/endroid/qr-code/src/Builder/Builder.php
+++ b/thirdparty/vendor/endroid/qr-code/src/Builder/Builder.php
@@ -4,276 +4,122 @@
namespace Endroid\QrCode\Builder;
+use Endroid\QrCode\Color\Color;
use Endroid\QrCode\Color\ColorInterface;
+use Endroid\QrCode\Encoding\Encoding;
use Endroid\QrCode\Encoding\EncodingInterface;
-use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelInterface;
+use Endroid\QrCode\ErrorCorrectionLevel;
use Endroid\QrCode\Exception\ValidationException;
-use Endroid\QrCode\Label\Alignment\LabelAlignmentInterface;
+use Endroid\QrCode\Label\Font\Font;
use Endroid\QrCode\Label\Font\FontInterface;
use Endroid\QrCode\Label\Label;
-use Endroid\QrCode\Label\LabelInterface;
+use Endroid\QrCode\Label\LabelAlignment;
+use Endroid\QrCode\Label\Margin\Margin;
use Endroid\QrCode\Label\Margin\MarginInterface;
use Endroid\QrCode\Logo\Logo;
-use Endroid\QrCode\Logo\LogoInterface;
use Endroid\QrCode\QrCode;
-use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeInterface;
+use Endroid\QrCode\RoundBlockSizeMode;
use Endroid\QrCode\Writer\PngWriter;
use Endroid\QrCode\Writer\Result\ResultInterface;
use Endroid\QrCode\Writer\ValidatingWriterInterface;
use Endroid\QrCode\Writer\WriterInterface;
-class Builder implements BuilderInterface
+final readonly class Builder implements BuilderInterface
{
- /**
- * @var array{
- * data: string,
- * writer: WriterInterface,
- * writerOptions: array,
- * qrCodeClass: class-string,
- * logoClass: class-string,
- * labelClass: class-string,
- * validateResult: bool,
- * size?: int,
- * encoding?: EncodingInterface,
- * errorCorrectionLevel?: ErrorCorrectionLevelInterface,
- * roundBlockSizeMode?: RoundBlockSizeModeInterface,
- * margin?: int,
- * backgroundColor?: ColorInterface,
- * foregroundColor?: ColorInterface,
- * labelText?: string,
- * labelFont?: FontInterface,
- * labelAlignment?: LabelAlignmentInterface,
- * labelMargin?: MarginInterface,
- * labelTextColor?: ColorInterface,
- * logoPath?: string,
- * logoResizeToWidth?: int,
- * logoResizeToHeight?: int,
- * logoPunchoutBackground?: bool
- * }
- */
- private array $options;
-
- public function __construct()
- {
- $this->options = [
- 'data' => '',
- 'writer' => new PngWriter(),
- 'writerOptions' => [],
- 'qrCodeClass' => QrCode::class,
- 'logoClass' => Logo::class,
- 'labelClass' => Label::class,
- 'validateResult' => false,
- ];
- }
-
- public static function create(): BuilderInterface
- {
- return new self();
- }
-
- public function writer(WriterInterface $writer): BuilderInterface
- {
- $this->options['writer'] = $writer;
-
- return $this;
- }
-
- /** @param array $writerOptions */
- public function writerOptions(array $writerOptions): BuilderInterface
- {
- $this->options['writerOptions'] = $writerOptions;
-
- return $this;
- }
-
- public function data(string $data): BuilderInterface
- {
- $this->options['data'] = $data;
-
- return $this;
- }
-
- public function encoding(EncodingInterface $encoding): BuilderInterface
- {
- $this->options['encoding'] = $encoding;
-
- return $this;
- }
-
- public function errorCorrectionLevel(ErrorCorrectionLevelInterface $errorCorrectionLevel): BuilderInterface
- {
- $this->options['errorCorrectionLevel'] = $errorCorrectionLevel;
-
- return $this;
- }
-
- public function size(int $size): BuilderInterface
- {
- $this->options['size'] = $size;
-
- return $this;
- }
-
- public function margin(int $margin): BuilderInterface
- {
- $this->options['margin'] = $margin;
-
- return $this;
- }
-
- public function roundBlockSizeMode(RoundBlockSizeModeInterface $roundBlockSizeMode): BuilderInterface
- {
- $this->options['roundBlockSizeMode'] = $roundBlockSizeMode;
-
- return $this;
- }
-
- public function foregroundColor(ColorInterface $foregroundColor): BuilderInterface
- {
- $this->options['foregroundColor'] = $foregroundColor;
-
- return $this;
- }
-
- public function backgroundColor(ColorInterface $backgroundColor): BuilderInterface
- {
- $this->options['backgroundColor'] = $backgroundColor;
-
- return $this;
- }
-
- public function logoPath(string $logoPath): BuilderInterface
- {
- $this->options['logoPath'] = $logoPath;
-
- return $this;
- }
-
- public function logoResizeToWidth(int $logoResizeToWidth): BuilderInterface
- {
- $this->options['logoResizeToWidth'] = $logoResizeToWidth;
-
- return $this;
- }
-
- public function logoResizeToHeight(int $logoResizeToHeight): BuilderInterface
- {
- $this->options['logoResizeToHeight'] = $logoResizeToHeight;
-
- return $this;
- }
-
- public function logoPunchoutBackground(bool $logoPunchoutBackground): BuilderInterface
- {
- $this->options['logoPunchoutBackground'] = $logoPunchoutBackground;
-
- return $this;
- }
-
- public function labelText(string $labelText): BuilderInterface
- {
- $this->options['labelText'] = $labelText;
-
- return $this;
- }
-
- public function labelFont(FontInterface $labelFont): BuilderInterface
- {
- $this->options['labelFont'] = $labelFont;
-
- return $this;
- }
-
- public function labelAlignment(LabelAlignmentInterface $labelAlignment): BuilderInterface
- {
- $this->options['labelAlignment'] = $labelAlignment;
-
- return $this;
- }
-
- public function labelMargin(MarginInterface $labelMargin): BuilderInterface
- {
- $this->options['labelMargin'] = $labelMargin;
-
- return $this;
- }
-
- public function labelTextColor(ColorInterface $labelTextColor): BuilderInterface
- {
- $this->options['labelTextColor'] = $labelTextColor;
-
- return $this;
- }
-
- public function validateResult(bool $validateResult): BuilderInterface
- {
- $this->options['validateResult'] = $validateResult;
-
- return $this;
- }
-
- public function build(): ResultInterface
- {
- $writer = $this->options['writer'];
-
- if ($this->options['validateResult'] && !$writer instanceof ValidatingWriterInterface) {
- throw ValidationException::createForUnsupportedWriter(strval(get_class($writer)));
+ public function __construct(
+ private WriterInterface $writer = new PngWriter(),
+ /** @var array */
+ private array $writerOptions = [],
+ private bool $validateResult = false,
+ // QrCode options
+ private string $data = '',
+ private EncodingInterface $encoding = new Encoding('UTF-8'),
+ private ErrorCorrectionLevel $errorCorrectionLevel = ErrorCorrectionLevel::Low,
+ private int $size = 300,
+ private int $margin = 10,
+ private RoundBlockSizeMode $roundBlockSizeMode = RoundBlockSizeMode::Margin,
+ private ColorInterface $foregroundColor = new Color(0, 0, 0),
+ private ColorInterface $backgroundColor = new Color(255, 255, 255),
+ // Label options
+ private string $labelText = '',
+ private FontInterface $labelFont = new Font(__DIR__.'/../../assets/open_sans.ttf', 16),
+ private LabelAlignment $labelAlignment = LabelAlignment::Center,
+ private MarginInterface $labelMargin = new Margin(0, 10, 10, 10),
+ private ColorInterface $labelTextColor = new Color(0, 0, 0),
+ // Logo options
+ private string $logoPath = '',
+ private ?int $logoResizeToWidth = null,
+ private ?int $logoResizeToHeight = null,
+ private bool $logoPunchoutBackground = false,
+ ) {
+ }
+
+ /** @param array|null $writerOptions */
+ public function build(
+ ?WriterInterface $writer = null,
+ ?array $writerOptions = null,
+ ?bool $validateResult = null,
+ // QrCode options
+ ?string $data = null,
+ ?EncodingInterface $encoding = null,
+ ?ErrorCorrectionLevel $errorCorrectionLevel = null,
+ ?int $size = null,
+ ?int $margin = null,
+ ?RoundBlockSizeMode $roundBlockSizeMode = null,
+ ?ColorInterface $foregroundColor = null,
+ ?ColorInterface $backgroundColor = null,
+ // Label options
+ ?string $labelText = null,
+ ?FontInterface $labelFont = null,
+ ?LabelAlignment $labelAlignment = null,
+ ?MarginInterface $labelMargin = null,
+ ?ColorInterface $labelTextColor = null,
+ // Logo options
+ ?string $logoPath = null,
+ ?int $logoResizeToWidth = null,
+ ?int $logoResizeToHeight = null,
+ ?bool $logoPunchoutBackground = null,
+ ): ResultInterface {
+ if ($this->validateResult && !$this->writer instanceof ValidatingWriterInterface) {
+ throw ValidationException::createForUnsupportedWriter(get_class($this->writer));
}
- /** @var QrCode $qrCode */
- $qrCode = $this->buildObject($this->options['qrCodeClass']);
-
- /** @var LogoInterface|null $logo */
- $logo = $this->buildObject($this->options['logoClass'], 'logo');
-
- /** @var LabelInterface|null $label */
- $label = $this->buildObject($this->options['labelClass'], 'label');
-
- $result = $writer->write($qrCode, $logo, $label, $this->options['writerOptions']);
-
- if ($this->options['validateResult'] && $writer instanceof ValidatingWriterInterface) {
+ $writer = $writer ?? $this->writer;
+ $writerOptions = $writerOptions ?? $this->writerOptions;
+ $validateResult = $validateResult ?? $this->validateResult;
+
+ $qrCode = new QrCode(
+ data: $data ?? $this->data,
+ encoding: $encoding ?? $this->encoding,
+ errorCorrectionLevel: $errorCorrectionLevel ?? $this->errorCorrectionLevel,
+ size: $size ?? $this->size,
+ margin: $margin ?? $this->margin,
+ roundBlockSizeMode: $roundBlockSizeMode ?? $this->roundBlockSizeMode,
+ foregroundColor: $foregroundColor ?? $this->foregroundColor,
+ backgroundColor: $backgroundColor ?? $this->backgroundColor
+ );
+
+ $logo = $this->logoPath ? new Logo(
+ path: $logoPath ?? $this->logoPath,
+ resizeToWidth: $logoResizeToWidth ?? $this->logoResizeToWidth,
+ resizeToHeight: $logoResizeToHeight ?? $this->logoResizeToHeight,
+ punchoutBackground: $logoPunchoutBackground ?? $this->logoPunchoutBackground
+ ) : null;
+
+ $label = $this->labelText ? new Label(
+ text: $labelText ?? $this->labelText,
+ font: $labelFont ?? $this->labelFont,
+ alignment: $labelAlignment ?? $this->labelAlignment,
+ margin: $labelMargin ?? $this->labelMargin,
+ textColor: $labelTextColor ?? $this->labelTextColor
+ ) : null;
+
+ $result = $writer->write($qrCode, $logo, $label, $writerOptions);
+
+ if ($validateResult && $writer instanceof ValidatingWriterInterface) {
$writer->validateResult($result, $qrCode->getData());
}
return $result;
}
-
- /**
- * @param class-string $class
- *
- * @return mixed
- */
- private function buildObject(string $class, string $optionsPrefix = null)
- {
- /** @var \ReflectionClass