diff options
Diffstat (limited to 'vendor/chillerlan/php-qrcode/src')
14 files changed, 132 insertions, 87 deletions
diff --git a/vendor/chillerlan/php-qrcode/src/Data/MaskPatternTester.php b/vendor/chillerlan/php-qrcode/src/Data/MaskPatternTester.php index 7874cb53d..959892b9b 100644 --- a/vendor/chillerlan/php-qrcode/src/Data/MaskPatternTester.php +++ b/vendor/chillerlan/php-qrcode/src/Data/MaskPatternTester.php @@ -130,7 +130,7 @@ final class MaskPatternTester{ } if( - $val === $m[$y][$x + 1] + $val === $row[$x + 1] && $val === $m[$y + 1][$x] && $val === $m[$y + 1][$x + 1] ){ @@ -154,12 +154,12 @@ final class MaskPatternTester{ if( $x + 6 < $size && $val - && !$m[$y][$x + 1] - && $m[$y][$x + 2] - && $m[$y][$x + 3] - && $m[$y][$x + 4] - && !$m[$y][$x + 5] - && $m[$y][$x + 6] + && !$row[$x + 1] + && $row[$x + 2] + && $row[$x + 3] + && $row[$x + 4] + && !$row[$x + 5] + && $row[$x + 6] ){ $penalties++; } @@ -189,8 +189,8 @@ final class MaskPatternTester{ protected function testLevel4(array $m, int $size):float{ $count = 0; - foreach($m as $y => $row){ - foreach($row as $x => $val){ + foreach($m as $row){ + foreach($row as $val){ if($val){ $count++; } diff --git a/vendor/chillerlan/php-qrcode/src/Data/QRDataAbstract.php b/vendor/chillerlan/php-qrcode/src/Data/QRDataAbstract.php index 72b67b7b9..5d5b3aaf2 100644 --- a/vendor/chillerlan/php-qrcode/src/Data/QRDataAbstract.php +++ b/vendor/chillerlan/php-qrcode/src/Data/QRDataAbstract.php @@ -70,7 +70,7 @@ abstract class QRDataAbstract implements QRDataInterface{ /** * QRDataInterface constructor. */ - public function __construct(SettingsContainerInterface $options, string $data = null){ + public function __construct(SettingsContainerInterface $options, ?string $data = null){ $this->options = $options; if($data !== null){ @@ -100,7 +100,7 @@ abstract class QRDataAbstract implements QRDataInterface{ /** * @inheritDoc */ - public function initMatrix(int $maskPattern, bool $test = null):QRMatrix{ + public function initMatrix(int $maskPattern, ?bool $test = null):QRMatrix{ return (new QRMatrix($this->version, $this->options->eccLevel)) ->init($maskPattern, $test) ->mapData($this->maskECC(), $maskPattern) diff --git a/vendor/chillerlan/php-qrcode/src/Data/QRDataInterface.php b/vendor/chillerlan/php-qrcode/src/Data/QRDataInterface.php index 93ad6221d..4e8aa9406 100644 --- a/vendor/chillerlan/php-qrcode/src/Data/QRDataInterface.php +++ b/vendor/chillerlan/php-qrcode/src/Data/QRDataInterface.php @@ -21,7 +21,7 @@ interface QRDataInterface{ /** * @var int[] */ - const CHAR_MAP_NUMBER = [ + public const CHAR_MAP_NUMBER = [ '0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, '7' => 7, '8' => 8, '9' => 9, ]; @@ -30,7 +30,7 @@ interface QRDataInterface{ * * @var int[] */ - const CHAR_MAP_ALPHANUM = [ + public const CHAR_MAP_ALPHANUM = [ '0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, '7' => 7, '8' => 8, '9' => 9, 'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13, 'E' => 14, 'F' => 15, 'G' => 16, 'H' => 17, 'I' => 18, 'J' => 19, 'K' => 20, 'L' => 21, 'M' => 22, 'N' => 23, @@ -46,7 +46,7 @@ interface QRDataInterface{ * * @var int [][][] */ - const MAX_LENGTH =[ + public const MAX_LENGTH =[ // v => [NUMERIC => [L, M, Q, H ], ALPHANUM => [L, M, Q, H], BINARY => [L, M, Q, H ], KANJI => [L, M, Q, H ]] // modules 1 => [[ 41, 34, 27, 17], [ 25, 20, 16, 10], [ 17, 14, 11, 7], [ 10, 8, 7, 4]], // 21 2 => [[ 77, 63, 48, 34], [ 47, 38, 29, 20], [ 32, 26, 20, 14], [ 20, 16, 12, 8]], // 25 @@ -95,7 +95,7 @@ interface QRDataInterface{ * * @var int [][] */ - const MAX_BITS = [ + public const MAX_BITS = [ // version => [L, M, Q, H ] 1 => [ 152, 128, 104, 72], 2 => [ 272, 224, 176, 128], @@ -144,7 +144,7 @@ interface QRDataInterface{ * * @var int [][][] */ - const RSBLOCKS = [ + public const RSBLOCKS = [ 1 => [[ 1, 0, 26, 19], [ 1, 0, 26, 16], [ 1, 0, 26, 13], [ 1, 0, 26, 9]], 2 => [[ 1, 0, 44, 34], [ 1, 0, 44, 28], [ 1, 0, 44, 22], [ 1, 0, 44, 16]], 3 => [[ 1, 0, 70, 55], [ 1, 0, 70, 44], [ 2, 0, 35, 17], [ 2, 0, 35, 13]], @@ -195,6 +195,6 @@ interface QRDataInterface{ /** * returns a fresh matrix object with the data written for the given $maskPattern */ - public function initMatrix(int $maskPattern, bool $test = null):QRMatrix; + public function initMatrix(int $maskPattern, ?bool $test = null):QRMatrix; } diff --git a/vendor/chillerlan/php-qrcode/src/Data/QRMatrix.php b/vendor/chillerlan/php-qrcode/src/Data/QRMatrix.php index 05c8b9069..3bdae926a 100755 --- a/vendor/chillerlan/php-qrcode/src/Data/QRMatrix.php +++ b/vendor/chillerlan/php-qrcode/src/Data/QRMatrix.php @@ -25,32 +25,71 @@ use function array_fill, array_key_exists, array_push, array_unshift, count, flo */ final class QRMatrix{ + /* + * special values + */ + + /** @var int */ + public const M_NULL = 0x00; + /** @var int */ + public const M_LOGO = 0x14; + /** @var int */ + public const M_LOGO_DARK = self::M_LOGO << 8; + + /* + * light values + */ + + /** @var int */ + public const M_DATA = 0x04; + /** @var int */ + public const M_FINDER = 0x06; + /** @var int */ + public const M_SEPARATOR = 0x08; + /** @var int */ + public const M_ALIGNMENT = 0x0a; /** @var int */ - public const M_NULL = 0x00; + public const M_TIMING = 0x0c; /** @var int */ - public const M_DARKMODULE = 0x02; + public const M_FORMAT = 0x0e; /** @var int */ - public const M_DATA = 0x04; + public const M_VERSION = 0x10; /** @var int */ - public const M_FINDER = 0x06; + public const M_QUIETZONE = 0x12; + + /* + * dark values + */ + + /** @var int */ + public const M_DARKMODULE = self::M_DARKMODULE_LIGHT << 8; + /** @var int */ + public const M_DATA_DARK = self::M_DATA << 8; + /** @var int */ + public const M_FINDER_DARK = self::M_FINDER << 8; /** @var int */ - public const M_SEPARATOR = 0x08; + public const M_ALIGNMENT_DARK = self::M_ALIGNMENT << 8; /** @var int */ - public const M_ALIGNMENT = 0x0a; + public const M_TIMING_DARK = self::M_TIMING << 8; /** @var int */ - public const M_TIMING = 0x0c; + public const M_FORMAT_DARK = self::M_FORMAT << 8; /** @var int */ - public const M_FORMAT = 0x0e; + public const M_VERSION_DARK = self::M_VERSION << 8; /** @var int */ - public const M_VERSION = 0x10; + public const M_FINDER_DOT = self::M_FINDER_DOT_LIGHT << 8; + + /* + * values used for reversed reflectance + */ + /** @var int */ - public const M_QUIETZONE = 0x12; + public const M_DARKMODULE_LIGHT = 0x02; /** @var int */ - public const M_LOGO = 0x14; + public const M_FINDER_DOT_LIGHT = 0x16; /** @var int */ - public const M_FINDER_DOT = 0x16; + public const M_SEPARATOR_DARK = self::M_SEPARATOR << 8; /** @var int */ - public const M_TEST = 0xff; + public const M_QUIETZONE_DARK = self::M_QUIETZONE << 8; /** * ISO/IEC 18004:2000 Annex E, Table E.1 - Row/column coordinates of center module of Alignment Patterns @@ -247,7 +286,7 @@ final class QRMatrix{ /** * shortcut to initialize the matrix */ - public function init(int $maskPattern, bool $test = null):QRMatrix{ + public function init(int $maskPattern, ?bool $test = null):QRMatrix{ return $this ->setFinderPattern() ->setSeparators() @@ -350,7 +389,7 @@ final class QRMatrix{ * Sets the "dark module", that is always on the same position 1x1px away from the bottom left finder */ public function setDarkModule():QRMatrix{ - $this->set(8, 4 * $this->version + 9, true, $this::M_DARKMODULE); + $this->set(8, 4 * $this->version + 9, true, $this::M_DARKMODULE_LIGHT); return $this; } @@ -364,8 +403,8 @@ final class QRMatrix{ $pos = [ [0, 0], // top left - [$this->moduleCount - 7, 0], // bottom left - [0, $this->moduleCount - 7], // top right + [$this->moduleCount - 7, 0], // top right + [0, $this->moduleCount - 7], // bottom left ]; foreach($pos as $c){ @@ -381,7 +420,7 @@ final class QRMatrix{ } // 3*3 dot else{ - $this->set($c[0] + $y, $c[1] + $x, true, $this::M_FINDER_DOT); + $this->set($c[0] + $y, $c[1] + $x, true, $this::M_FINDER_DOT_LIGHT); } } } @@ -477,7 +516,7 @@ final class QRMatrix{ * * ISO/IEC 18004:2000 Section 8.10 */ - public function setVersionNumber(bool $test = null):QRMatrix{ + public function setVersionNumber(?bool $test = null):QRMatrix{ $bits = $this::versionPattern[$this->version] ?? false; if($bits !== false){ @@ -501,7 +540,7 @@ final class QRMatrix{ * * ISO/IEC 18004:2000 Section 8.9 */ - public function setFormatInfo(int $maskPattern, bool $test = null):QRMatrix{ + public function setFormatInfo(int $maskPattern, ?bool $test = null):QRMatrix{ $bits = $this::formatPattern[QRCode::ECC_MODES[$this->eclevel]][$maskPattern] ?? 0; for($i = 0; $i < 15; $i++){ @@ -541,7 +580,7 @@ final class QRMatrix{ * * @throws \chillerlan\QRCode\Data\QRCodeDataException */ - public function setQuietZone(int $size = null):QRMatrix{ + public function setQuietZone(?int $size = null):QRMatrix{ if($this->matrix[$this->moduleCount - 1][$this->moduleCount - 1] === $this::M_NULL){ throw new QRCodeDataException('use only after writing data'); @@ -588,7 +627,7 @@ final class QRMatrix{ * * @throws \chillerlan\QRCode\Data\QRCodeDataException */ - public function setLogoSpace(int $width, int $height, int $startX = null, int $startY = null):QRMatrix{ + public function setLogoSpace(int $width, int $height, ?int $startX = null, ?int $startY = null):QRMatrix{ // for logos we operate in ECC H (30%) only if($this->eclevel !== QRCode::ECC_H){ @@ -624,8 +663,8 @@ final class QRMatrix{ $startY = ($startY !== null ? $startY : ($length - $height) / 2) + $qz; // clear the space - foreach($this->matrix as $y => $row){ - foreach($row as $x => $val){ + for($y = 0; $y < $this->moduleCount; $y++){ + for($x = 0; $x < $this->moduleCount; $x++){ // out of bounds, skip if($x < $start || $y < $start ||$x >= $end || $y >= $end){ continue; diff --git a/vendor/chillerlan/php-qrcode/src/Helpers/Polynomial.php b/vendor/chillerlan/php-qrcode/src/Helpers/Polynomial.php index c42e0831c..fa4046086 100644 --- a/vendor/chillerlan/php-qrcode/src/Helpers/Polynomial.php +++ b/vendor/chillerlan/php-qrcode/src/Helpers/Polynomial.php @@ -69,7 +69,7 @@ final class Polynomial{ /** * Polynomial constructor. */ - public function __construct(array $num = null, int $shift = null){ + public function __construct(?array $num = null, ?int $shift = null){ $this->setNum($num ?? [1], $shift); } @@ -86,7 +86,7 @@ final class Polynomial{ * * @return \chillerlan\QRCode\Helpers\Polynomial */ - public function setNum(array $num, int $shift = null):Polynomial{ + public function setNum(array $num, ?int $shift = null):Polynomial{ $offset = 0; $numCount = count($num); @@ -157,7 +157,7 @@ final class Polynomial{ throw new QRCodeException(sprintf('log(%s)', $n)); } - return Polynomial::table[$n][1]; + return self::table[$n][1]; } /** @@ -172,7 +172,7 @@ final class Polynomial{ $n -= 255; } - return Polynomial::table[$n][0]; + return self::table[$n][0]; } } diff --git a/vendor/chillerlan/php-qrcode/src/Output/QRFpdf.php b/vendor/chillerlan/php-qrcode/src/Output/QRFpdf.php index a15ae9ff3..b8e6694e8 100644 --- a/vendor/chillerlan/php-qrcode/src/Output/QRFpdf.php +++ b/vendor/chillerlan/php-qrcode/src/Output/QRFpdf.php @@ -68,7 +68,7 @@ class QRFpdf extends QROutputAbstract{ * * @return string|\FPDF */ - public function dump(string $file = null){ + public function dump(?string $file = null){ $file ??= $this->options->cachefile; $fpdf = new FPDF('P', $this->options->fpdfMeasureUnit, [$this->length, $this->length]); diff --git a/vendor/chillerlan/php-qrcode/src/Output/QRImage.php b/vendor/chillerlan/php-qrcode/src/Output/QRImage.php index 8f533d341..c67c625b2 100644 --- a/vendor/chillerlan/php-qrcode/src/Output/QRImage.php +++ b/vendor/chillerlan/php-qrcode/src/Output/QRImage.php @@ -94,7 +94,7 @@ class QRImage extends QROutputAbstract{ * * @phan-suppress PhanUndeclaredTypeReturnType, PhanTypeMismatchReturn */ - public function dump(string $file = null){ + public function dump(?string $file = null){ $file ??= $this->options->cachefile; $this->image = imagecreatetruecolor($this->length, $this->length); diff --git a/vendor/chillerlan/php-qrcode/src/Output/QRImagick.php b/vendor/chillerlan/php-qrcode/src/Output/QRImagick.php index 49516d30e..ec0f6d5b0 100644 --- a/vendor/chillerlan/php-qrcode/src/Output/QRImagick.php +++ b/vendor/chillerlan/php-qrcode/src/Output/QRImagick.php @@ -67,7 +67,7 @@ class QRImagick extends QROutputAbstract{ * * @return string|\Imagick */ - public function dump(string $file = null){ + public function dump(?string $file = null){ $file ??= $this->options->cachefile; $this->imagick = new Imagick; diff --git a/vendor/chillerlan/php-qrcode/src/Output/QRMarkup.php b/vendor/chillerlan/php-qrcode/src/Output/QRMarkup.php index 06d6e88cb..1f7843182 100644 --- a/vendor/chillerlan/php-qrcode/src/Output/QRMarkup.php +++ b/vendor/chillerlan/php-qrcode/src/Output/QRMarkup.php @@ -53,7 +53,7 @@ class QRMarkup extends QROutputAbstract{ /** * HTML output */ - protected function html(string $file = null):string{ + protected function html(?string $file = null):string{ $html = empty($this->options->cssClass) ? '<div>' @@ -74,9 +74,11 @@ class QRMarkup extends QROutputAbstract{ $html .= '</div>'.$this->options->eol; if($file !== null){ - return '<!DOCTYPE html>'. - '<head><meta charset="UTF-8"><title>QR Code</title></head>'. - '<body>'.$this->options->eol.$html.'</body>'; + /** @noinspection HtmlRequiredLangAttribute */ + return sprintf( + '<!DOCTYPE html><html><head><meta charset="UTF-8"><title>QR Code</title></head><body>%s</body></html>', + $this->options->eol.$html + ); } return $html; @@ -87,7 +89,7 @@ class QRMarkup extends QROutputAbstract{ * * @see https://github.com/codemasher/php-qrcode/pull/5 */ - protected function svg(string $file = null):string{ + protected function svg(?string $file = null):string{ $matrix = $this->matrix->matrix(); $svg = sprintf($this->svgHeader, $this->options->cssClass, $this->options->svgViewBoxSize ?? $this->moduleCount) diff --git a/vendor/chillerlan/php-qrcode/src/Output/QROutputAbstract.php b/vendor/chillerlan/php-qrcode/src/Output/QROutputAbstract.php index d4ed3d0c9..78e761093 100644 --- a/vendor/chillerlan/php-qrcode/src/Output/QROutputAbstract.php +++ b/vendor/chillerlan/php-qrcode/src/Output/QROutputAbstract.php @@ -12,7 +12,8 @@ namespace chillerlan\QRCode\Output; -use chillerlan\QRCode\{Data\QRMatrix, QRCode}; +use chillerlan\QRCode\QRCode; +use chillerlan\QRCode\Data\QRMatrix; use chillerlan\Settings\SettingsContainerInterface; use function call_user_func_array, dirname, file_put_contents, get_called_class, in_array, is_writable, sprintf; @@ -112,7 +113,7 @@ abstract class QROutputAbstract implements QROutputInterface{ /** * @inheritDoc */ - public function dump(string $file = null){ + public function dump(?string $file = null){ $file ??= $this->options->cachefile; // call the built-in output method with the optional file path as parameter diff --git a/vendor/chillerlan/php-qrcode/src/Output/QROutputInterface.php b/vendor/chillerlan/php-qrcode/src/Output/QROutputInterface.php index b07b8e7a5..7052701b9 100644 --- a/vendor/chillerlan/php-qrcode/src/Output/QROutputInterface.php +++ b/vendor/chillerlan/php-qrcode/src/Output/QROutputInterface.php @@ -19,29 +19,32 @@ use chillerlan\QRCode\Data\QRMatrix; */ interface QROutputInterface{ - const DEFAULT_MODULE_VALUES = [ + public const DEFAULT_MODULE_VALUES = [ // light - QRMatrix::M_NULL => false, // 0 - QRMatrix::M_DATA => false, // 4 - QRMatrix::M_FINDER => false, // 6 - QRMatrix::M_SEPARATOR => false, // 8 - QRMatrix::M_ALIGNMENT => false, // 10 - QRMatrix::M_TIMING => false, // 12 - QRMatrix::M_FORMAT => false, // 14 - QRMatrix::M_VERSION => false, // 16 - QRMatrix::M_QUIETZONE => false, // 18 - QRMatrix::M_LOGO => false, // 20 - QRMatrix::M_TEST => false, // 255 + QRMatrix::M_NULL => false, + QRMatrix::M_DARKMODULE_LIGHT => false, + QRMatrix::M_DATA => false, + QRMatrix::M_FINDER => false, + QRMatrix::M_SEPARATOR => false, + QRMatrix::M_ALIGNMENT => false, + QRMatrix::M_TIMING => false, + QRMatrix::M_FORMAT => false, + QRMatrix::M_VERSION => false, + QRMatrix::M_QUIETZONE => false, + QRMatrix::M_LOGO => false, + QRMatrix::M_FINDER_DOT_LIGHT => false, // dark - QRMatrix::M_DARKMODULE << 8 => true, // 512 - QRMatrix::M_DATA << 8 => true, // 1024 - QRMatrix::M_FINDER << 8 => true, // 1536 - QRMatrix::M_ALIGNMENT << 8 => true, // 2560 - QRMatrix::M_TIMING << 8 => true, // 3072 - QRMatrix::M_FORMAT << 8 => true, // 3584 - QRMatrix::M_VERSION << 8 => true, // 4096 - QRMatrix::M_FINDER_DOT << 8 => true, // 5632 - QRMatrix::M_TEST << 8 => true, // 65280 + QRMatrix::M_DARKMODULE => true, + QRMatrix::M_DATA_DARK => true, + QRMatrix::M_FINDER_DARK => true, + QRMatrix::M_SEPARATOR_DARK => true, + QRMatrix::M_ALIGNMENT_DARK => true, + QRMatrix::M_TIMING_DARK => true, + QRMatrix::M_FORMAT_DARK => true, + QRMatrix::M_VERSION_DARK => true, + QRMatrix::M_QUIETZONE_DARK => true, + QRMatrix::M_LOGO_DARK => true, + QRMatrix::M_FINDER_DOT => true, ]; /** @@ -49,6 +52,6 @@ interface QROutputInterface{ * * @return mixed */ - public function dump(string $file = null); + public function dump(?string $file = null); } diff --git a/vendor/chillerlan/php-qrcode/src/Output/QRString.php b/vendor/chillerlan/php-qrcode/src/Output/QRString.php index 3ed5153e1..441ef99fd 100644 --- a/vendor/chillerlan/php-qrcode/src/Output/QRString.php +++ b/vendor/chillerlan/php-qrcode/src/Output/QRString.php @@ -50,7 +50,7 @@ class QRString extends QROutputAbstract{ /** * string output */ - protected function text(string $file = null):string{ + protected function text(?string $file = null):string{ $str = []; foreach($this->matrix->matrix() as $row){ @@ -69,7 +69,7 @@ class QRString extends QROutputAbstract{ /** * JSON output */ - protected function json(string $file = null):string{ + protected function json(?string $file = null):string{ return json_encode($this->matrix->matrix()); } diff --git a/vendor/chillerlan/php-qrcode/src/QRCode.php b/vendor/chillerlan/php-qrcode/src/QRCode.php index 908030feb..1dad921e4 100755 --- a/vendor/chillerlan/php-qrcode/src/QRCode.php +++ b/vendor/chillerlan/php-qrcode/src/QRCode.php @@ -117,23 +117,23 @@ class QRCode{ * @var string[][] */ public const OUTPUT_MODES = [ - QRMarkup::class => [ + QRMarkup::class => [ self::OUTPUT_MARKUP_SVG, self::OUTPUT_MARKUP_HTML, ], - QRImage::class => [ + QRImage::class => [ self::OUTPUT_IMAGE_PNG, self::OUTPUT_IMAGE_GIF, self::OUTPUT_IMAGE_JPG, ], - QRString::class => [ + QRString::class => [ self::OUTPUT_STRING_JSON, self::OUTPUT_STRING_TEXT, ], QRImagick::class => [ self::OUTPUT_IMAGICK, ], - QRFpdf::class => [ + QRFpdf::class => [ self::OUTPUT_FPDF ] ]; @@ -167,7 +167,7 @@ class QRCode{ * * Sets the options instance, determines the current mb-encoding and sets it to UTF-8 */ - public function __construct(SettingsContainerInterface $options = null){ + public function __construct(?SettingsContainerInterface $options = null){ $this->options = $options ?? new QROptions; } @@ -176,7 +176,7 @@ class QRCode{ * * @return mixed */ - public function render(string $data, string $file = null){ + public function render(string $data, ?string $file = null){ return $this->initOutputInterface($data)->dump($file); } diff --git a/vendor/chillerlan/php-qrcode/src/QROptionsTrait.php b/vendor/chillerlan/php-qrcode/src/QROptionsTrait.php index 74c384b13..13dfba136 100644 --- a/vendor/chillerlan/php-qrcode/src/QROptionsTrait.php +++ b/vendor/chillerlan/php-qrcode/src/QROptionsTrait.php @@ -140,12 +140,12 @@ trait QROptionsTrait{ /** * string substitute for dark */ - protected string $textDark = '🔴'; + protected string $textDark = '██'; /** * string substitute for light */ - protected string $textLight = 'â•'; + protected string $textLight = 'â–‘â–‘'; /** * markup substitute for dark (CSS value) |