@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $otherToX = (int)($fromX + ($otherToX - $fromX) * $scale); |
| 154 | - $result += $this->sizeOfBlackWhiteBlackRun((int)$fromX, (int)$fromY, $otherToX, $otherToY); |
|
| 154 | + $result += $this->sizeOfBlackWhiteBlackRun((int)$fromX, (int)$fromY, $otherToX, $otherToY); |
|
| 155 | 155 | |
| 156 | 156 | // Middle pixel is double-counted this way; subtract 1 |
| 157 | 157 | return $result - 1.0; |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | int $estAlignmentX, |
| 277 | 277 | int $estAlignmentY, |
| 278 | 278 | float $allowanceFactor |
| 279 | - ):?AlignmentPattern{ |
|
| 279 | + ): ?AlignmentPattern{ |
|
| 280 | 280 | // Look for an alignment pattern (3 modules in size) around where it should be |
| 281 | 281 | $dimension = $this->matrix->size(); |
| 282 | 282 | $allowance = (int)($allowanceFactor * $overallEstModuleSize); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | public function __construct(BitMatrix $matrix, float $moduleSize){ |
| 45 | 45 | $this->matrix = $matrix; |
| 46 | 46 | $this->moduleSize = $moduleSize; |
| 47 | - $this->possibleCenters = []; |
|
| 47 | + $this->possibleCenters = []; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * @return \chillerlan\QRCode\Detector\AlignmentPattern|null |
| 60 | 60 | */ |
| 61 | - public function find(int $startX, int $startY, int $width, int $height):?AlignmentPattern{ |
|
| 61 | + public function find(int $startX, int $startY, int $width, int $height): ?AlignmentPattern{ |
|
| 62 | 62 | $maxJ = $startX + $width; |
| 63 | 63 | $middleI = $startY + ($height / 2); |
| 64 | 64 | $stateCount = []; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * |
| 175 | 175 | * @return \chillerlan\QRCode\Detector\AlignmentPattern|null if we have found the same pattern twice, or null if not |
| 176 | 176 | */ |
| 177 | - private function handlePossibleCenter(array $stateCount, int $i, int $j):?AlignmentPattern{ |
|
| 177 | + private function handlePossibleCenter(array $stateCount, int $i, int $j): ?AlignmentPattern{ |
|
| 178 | 178 | $stateCountTotal = $stateCount[0] + $stateCount[1] + $stateCount[2]; |
| 179 | 179 | $centerJ = $this->centerFromEnd($stateCount, $j); |
| 180 | 180 | $centerI = $this->crossCheckVertical($i, (int)$centerJ, 2 * $stateCount[1], $stateCountTotal); |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | * |
| 224 | 224 | * @return float|null vertical center of alignment pattern, or null if not found |
| 225 | 225 | */ |
| 226 | - private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal):?float{ |
|
| 226 | + private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal): ?float{ |
|
| 227 | 227 | $maxI = $this->matrix->size(); |
| 228 | 228 | $stateCount = []; |
| 229 | 229 | $stateCount[0] = 0; |
@@ -222,8 +222,8 @@ discard block |
||
| 222 | 222 | // Should return null, but, some QR codes apparently do not mask this info. |
| 223 | 223 | // Try again by actually masking the pattern first. |
| 224 | 224 | $formatInfo = $this->doDecodeFormatInformation( |
| 225 | - $formatInfoBits1 ^ $this::FORMAT_INFO_MASK_QR, |
|
| 226 | - $formatInfoBits2 ^ $this::FORMAT_INFO_MASK_QR |
|
| 225 | + $formatInfoBits1^$this::FORMAT_INFO_MASK_QR, |
|
| 226 | + $formatInfoBits2^$this::FORMAT_INFO_MASK_QR |
|
| 227 | 227 | ); |
| 228 | 228 | |
| 229 | 229 | // still nothing??? |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | ? $this->check($j, $i) |
| 249 | 249 | : $this->check($i, $j); |
| 250 | 250 | |
| 251 | - return $bit ? ($versionBits << 1) | 0x1 : $versionBits << 1; |
|
| 251 | + return $bit ? ($versionBits << 1)|0x1 : $versionBits << 1; |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | /** |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | * |
| 259 | 259 | * @return int|null information about the format it specifies, or null if doesn't seem to match any known pattern |
| 260 | 260 | */ |
| 261 | - private function doDecodeFormatInformation(int $maskedFormatInfo1, int $maskedFormatInfo2):?int{ |
|
| 261 | + private function doDecodeFormatInformation(int $maskedFormatInfo1, int $maskedFormatInfo2): ?int{ |
|
| 262 | 262 | // Find the int in FORMAT_INFO_DECODE_LOOKUP with fewest bits differing |
| 263 | 263 | $bestDifference = PHP_INT_MAX; |
| 264 | 264 | $bestFormatInfo = 0; |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | /** |
| 355 | 355 | * |
| 356 | 356 | */ |
| 357 | - private function decodeVersionInformation(int $versionBits):?Version{ |
|
| 357 | + private function decodeVersionInformation(int $versionBits): ?Version{ |
|
| 358 | 358 | $bestDifference = PHP_INT_MAX; |
| 359 | 359 | $bestVersion = 0; |
| 360 | 360 | |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | // This class uses 5x5 blocks to compute local luminance, where each block is 8x8 pixels. |
| 37 | 37 | // So this is the smallest dimension in each axis we can accept. |
| 38 | 38 | private const BLOCK_SIZE_POWER = 3; |
| 39 | - private const BLOCK_SIZE = 8; // ...0100...00 |
|
| 40 | - private const BLOCK_SIZE_MASK = 7; // ...0011...11 |
|
| 39 | + private const BLOCK_SIZE = 8; // ...0100...00 |
|
| 40 | + private const BLOCK_SIZE_MASK = 7; // ...0011...11 |
|
| 41 | 41 | private const MINIMUM_DIMENSION = 40; |
| 42 | 42 | private const MIN_DYNAMIC_RANGE = 24; |
| 43 | 43 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | for($xx = 0; $xx < self::BLOCK_SIZE; $xx++){ |
| 236 | 236 | $pixel = (int)($this->luminances[(int)($offset + $xx)]) & 0xff; |
| 237 | - $sum += $pixel; |
|
| 237 | + $sum += $pixel; |
|
| 238 | 238 | // still looking for good contrast |
| 239 | 239 | if($pixel < $min){ |
| 240 | 240 | $min = $pixel; |
@@ -59,13 +59,13 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | protected const neighbours = [ |
| 61 | 61 | 0b00000001 => [-1, -1], |
| 62 | - 0b00000010 => [ 0, -1], |
|
| 63 | - 0b00000100 => [ 1, -1], |
|
| 64 | - 0b00001000 => [ 1, 0], |
|
| 65 | - 0b00010000 => [ 1, 1], |
|
| 66 | - 0b00100000 => [ 0, 1], |
|
| 67 | - 0b01000000 => [-1, 1], |
|
| 68 | - 0b10000000 => [-1, 0] |
|
| 62 | + 0b00000010 => [0, -1], |
|
| 63 | + 0b00000100 => [1, -1], |
|
| 64 | + 0b00001000 => [1, 0], |
|
| 65 | + 0b00010000 => [1, 1], |
|
| 66 | + 0b00100000 => [0, 1], |
|
| 67 | + 0b01000000 => [-1, 1], |
|
| 68 | + 0b10000000 => [-1, 0] |
|
| 69 | 69 | ]; |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $matrix[$y] = []; |
| 139 | 139 | |
| 140 | 140 | foreach($row as $x => $val){ |
| 141 | - $matrix[$y][$x] = ($val & $this::IS_DARK) === $this::IS_DARK; |
|
| 141 | + $matrix[$y][$x] = ($val&$this::IS_DARK) === $this::IS_DARK; |
|
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | |
@@ -148,21 +148,21 @@ discard block |
||
| 148 | 148 | /** |
| 149 | 149 | * Returns the current version number |
| 150 | 150 | */ |
| 151 | - public function version():?Version{ |
|
| 151 | + public function version(): ?Version{ |
|
| 152 | 152 | return $this->version; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
| 156 | 156 | * Returns the current ECC level |
| 157 | 157 | */ |
| 158 | - public function eccLevel():?EccLevel{ |
|
| 158 | + public function eccLevel(): ?EccLevel{ |
|
| 159 | 159 | return $this->eccLevel; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
| 163 | 163 | * Returns the current mask pattern |
| 164 | 164 | */ |
| 165 | - public function maskPattern():?MaskPattern{ |
|
| 165 | + public function maskPattern(): ?MaskPattern{ |
|
| 166 | 166 | return $this->maskPattern; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | public function set(int $x, int $y, bool $value, int $M_TYPE):self{ |
| 197 | 197 | |
| 198 | 198 | if(isset($this->matrix[$y][$x])){ |
| 199 | - $this->matrix[$y][$x] = $M_TYPE | ($value ? $this::IS_DARK : 0); |
|
| 199 | + $this->matrix[$y][$x] = $M_TYPE|($value ? $this::IS_DARK : 0); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | return $this; |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | return false; |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - return ($this->matrix[$y][$x] & $M_TYPE) === $M_TYPE; |
|
| 228 | + return ($this->matrix[$y][$x]&$M_TYPE) === $M_TYPE; |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /** |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | [$ix, $iy] = $coord; |
| 271 | 271 | |
| 272 | 272 | // check if the field is the same type |
| 273 | - if($M_TYPE_VALUE !== null && ($this->get($x + $ix, $y + $iy) | $this::IS_DARK) !== ($M_TYPE_VALUE | $this::IS_DARK)){ |
|
| 273 | + if($M_TYPE_VALUE !== null && ($this->get($x + $ix, $y + $iy)|$this::IS_DARK) !== ($M_TYPE_VALUE|$this::IS_DARK)){ |
|
| 274 | 274 | continue; |
| 275 | 275 | } |
| 276 | 276 | |
@@ -349,8 +349,8 @@ discard block |
||
| 349 | 349 | |
| 350 | 350 | for($c = 0; $c < 3; $c++){ |
| 351 | 351 | for($i = 0; $i < 8; $i++){ |
| 352 | - $this->set($h[$c][0] , $h[$c][1] + $i, false, $this::M_SEPARATOR); |
|
| 353 | - $this->set($v[$c][0] - $i, $v[$c][1] , false, $this::M_SEPARATOR); |
|
| 352 | + $this->set($h[$c][0], $h[$c][1] + $i, false, $this::M_SEPARATOR); |
|
| 353 | + $this->set($v[$c][0] - $i, $v[$c][1], false, $this::M_SEPARATOR); |
|
| 354 | 354 | } |
| 355 | 355 | } |
| 356 | 356 | |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | foreach($this->matrix as $y => $row){ |
| 575 | 575 | foreach($row as $x => $val){ |
| 576 | 576 | // out of bounds, skip |
| 577 | - if($x < $start || $y < $start ||$x >= $end || $y >= $end){ |
|
| 577 | + if($x < $start || $y < $start || $x >= $end || $y >= $end){ |
|
| 578 | 578 | continue; |
| 579 | 579 | } |
| 580 | 580 | // a match |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | |
| 643 | 643 | foreach($this->matrix as $y => $row){ |
| 644 | 644 | foreach($row as $x => $val){ |
| 645 | - if($mask($x, $y) && ($val & $this::M_DATA) === $this::M_DATA){ |
|
| 645 | + if($mask($x, $y) && ($val&$this::M_DATA) === $this::M_DATA){ |
|
| 646 | 646 | $this->flip($x, $y); |
| 647 | 647 | } |
| 648 | 648 | } |
@@ -116,7 +116,7 @@ |
||
| 116 | 116 | |
| 117 | 117 | // scale down to the expected size |
| 118 | 118 | if($this->options->drawCircularModules && $this->options->scale <= 20){ |
| 119 | - $this->image = imagescale($this->image, $this->length/10, $this->length/10, IMG_BILINEAR_FIXED); |
|
| 119 | + $this->image = imagescale($this->image, $this->length / 10, $this->length / 10, IMG_BILINEAR_FIXED); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if($this->options->returnResource){ |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * @see \chillerlan\QRCode\Common\Version::AUTO |
| 34 | 34 | * @var int |
| 35 | 35 | */ |
| 36 | - public const VERSION_AUTO = Version::AUTO; |
|
| 36 | + public const VERSION_AUTO = Version::AUTO; |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * @deprecated 5.0.0 use MaskPattern::AUTO instead |
@@ -82,28 +82,28 @@ discard block |
||
| 82 | 82 | * @see \chillerlan\QRCode\Output\QROutputInterface::MARKUP_SVG |
| 83 | 83 | * @var string |
| 84 | 84 | */ |
| 85 | - public const OUTPUT_MARKUP_SVG = QROutputInterface::MARKUP_SVG; |
|
| 85 | + public const OUTPUT_MARKUP_SVG = QROutputInterface::MARKUP_SVG; |
|
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * @deprecated 5.0.0 use QROutputInterface::GDIMAGE_PNG instead |
| 89 | 89 | * @see \chillerlan\QRCode\Output\QROutputInterface::GDIMAGE_PNG |
| 90 | 90 | * @var string |
| 91 | 91 | */ |
| 92 | - public const OUTPUT_IMAGE_PNG = QROutputInterface::GDIMAGE_PNG; |
|
| 92 | + public const OUTPUT_IMAGE_PNG = QROutputInterface::GDIMAGE_PNG; |
|
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | 95 | * @deprecated 5.0.0 use QROutputInterface::GDIMAGE_JPG instead |
| 96 | 96 | * @see \chillerlan\QRCode\Output\QROutputInterface::GDIMAGE_JPG |
| 97 | 97 | * @var string |
| 98 | 98 | */ |
| 99 | - public const OUTPUT_IMAGE_JPG = QROutputInterface::GDIMAGE_JPG; |
|
| 99 | + public const OUTPUT_IMAGE_JPG = QROutputInterface::GDIMAGE_JPG; |
|
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | 102 | * @deprecated 5.0.0 use QROutputInterface::GDIMAGE_GIF instead |
| 103 | 103 | * @see \chillerlan\QRCode\Output\QROutputInterface::GDIMAGE_GIF |
| 104 | 104 | * @var string |
| 105 | 105 | */ |
| 106 | - public const OUTPUT_IMAGE_GIF = QROutputInterface::GDIMAGE_GIF; |
|
| 106 | + public const OUTPUT_IMAGE_GIF = QROutputInterface::GDIMAGE_GIF; |
|
| 107 | 107 | |
| 108 | 108 | /** |
| 109 | 109 | * @deprecated 5.0.0 use QROutputInterface::STRING_JSON instead |
@@ -124,35 +124,35 @@ discard block |
||
| 124 | 124 | * @see \chillerlan\QRCode\Output\QROutputInterface::IMAGICK |
| 125 | 125 | * @var string |
| 126 | 126 | */ |
| 127 | - public const OUTPUT_IMAGICK = QROutputInterface::IMAGICK; |
|
| 127 | + public const OUTPUT_IMAGICK = QROutputInterface::IMAGICK; |
|
| 128 | 128 | |
| 129 | 129 | /** |
| 130 | 130 | * @deprecated 5.0.0 use QROutputInterface::FPDF instead |
| 131 | 131 | * @see \chillerlan\QRCode\Output\QROutputInterface::FPDF |
| 132 | 132 | * @var string |
| 133 | 133 | */ |
| 134 | - public const OUTPUT_FPDF = QROutputInterface::FPDF; |
|
| 134 | + public const OUTPUT_FPDF = QROutputInterface::FPDF; |
|
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | 137 | * @deprecated 5.0.0 use QROutputInterface::EPS instead |
| 138 | 138 | * @see \chillerlan\QRCode\Output\QROutputInterface::EPS |
| 139 | 139 | * @var string |
| 140 | 140 | */ |
| 141 | - public const OUTPUT_EPS = QROutputInterface::EPS; |
|
| 141 | + public const OUTPUT_EPS = QROutputInterface::EPS; |
|
| 142 | 142 | |
| 143 | 143 | /** |
| 144 | 144 | * @deprecated 5.0.0 use QROutputInterface::CUSTOM instead |
| 145 | 145 | * @see \chillerlan\QRCode\Output\QROutputInterface::CUSTOM |
| 146 | 146 | * @var string |
| 147 | 147 | */ |
| 148 | - public const OUTPUT_CUSTOM = QROutputInterface::CUSTOM; |
|
| 148 | + public const OUTPUT_CUSTOM = QROutputInterface::CUSTOM; |
|
| 149 | 149 | |
| 150 | 150 | /** |
| 151 | 151 | * @deprecated 5.0.0 use QROutputInterface::MODES instead |
| 152 | 152 | * @see \chillerlan\QRCode\Output\QROutputInterface::MODES |
| 153 | 153 | * @var string[] |
| 154 | 154 | */ |
| 155 | - public const OUTPUT_MODES = QROutputInterface::MODES; |
|
| 155 | + public const OUTPUT_MODES = QROutputInterface::MODES; |
|
| 156 | 156 | |
| 157 | 157 | /** |
| 158 | 158 | * The settings container |
@@ -37,46 +37,46 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | private const MAX_BITS = [ |
| 39 | 39 | // [ L, M, Q, H] // v => modules |
| 40 | - [ null, null, null, null], // 0 => will be ignored, index starts at 1 |
|
| 41 | - [ 152, 128, 104, 72], // 1 => 21 |
|
| 42 | - [ 272, 224, 176, 128], // 2 => 25 |
|
| 43 | - [ 440, 352, 272, 208], // 3 => 29 |
|
| 44 | - [ 640, 512, 384, 288], // 4 => 33 |
|
| 45 | - [ 864, 688, 496, 368], // 5 => 37 |
|
| 46 | - [ 1088, 864, 608, 480], // 6 => 41 |
|
| 47 | - [ 1248, 992, 704, 528], // 7 => 45 |
|
| 48 | - [ 1552, 1232, 880, 688], // 8 => 49 |
|
| 49 | - [ 1856, 1456, 1056, 800], // 9 => 53 |
|
| 50 | - [ 2192, 1728, 1232, 976], // 10 => 57 |
|
| 51 | - [ 2592, 2032, 1440, 1120], // 11 => 61 |
|
| 52 | - [ 2960, 2320, 1648, 1264], // 12 => 65 |
|
| 53 | - [ 3424, 2672, 1952, 1440], // 13 => 69 NICE! |
|
| 54 | - [ 3688, 2920, 2088, 1576], // 14 => 73 |
|
| 55 | - [ 4184, 3320, 2360, 1784], // 15 => 77 |
|
| 56 | - [ 4712, 3624, 2600, 2024], // 16 => 81 |
|
| 57 | - [ 5176, 4056, 2936, 2264], // 17 => 85 |
|
| 58 | - [ 5768, 4504, 3176, 2504], // 18 => 89 |
|
| 59 | - [ 6360, 5016, 3560, 2728], // 19 => 93 |
|
| 60 | - [ 6888, 5352, 3880, 3080], // 20 => 97 |
|
| 61 | - [ 7456, 5712, 4096, 3248], // 21 => 101 |
|
| 62 | - [ 8048, 6256, 4544, 3536], // 22 => 105 |
|
| 63 | - [ 8752, 6880, 4912, 3712], // 23 => 109 |
|
| 64 | - [ 9392, 7312, 5312, 4112], // 24 => 113 |
|
| 65 | - [10208, 8000, 5744, 4304], // 25 => 117 |
|
| 66 | - [10960, 8496, 6032, 4768], // 26 => 121 |
|
| 67 | - [11744, 9024, 6464, 5024], // 27 => 125 |
|
| 68 | - [12248, 9544, 6968, 5288], // 28 => 129 |
|
| 69 | - [13048, 10136, 7288, 5608], // 29 => 133 |
|
| 70 | - [13880, 10984, 7880, 5960], // 30 => 137 |
|
| 71 | - [14744, 11640, 8264, 6344], // 31 => 141 |
|
| 72 | - [15640, 12328, 8920, 6760], // 32 => 145 |
|
| 73 | - [16568, 13048, 9368, 7208], // 33 => 149 |
|
| 74 | - [17528, 13800, 9848, 7688], // 34 => 153 |
|
| 75 | - [18448, 14496, 10288, 7888], // 35 => 157 |
|
| 76 | - [19472, 15312, 10832, 8432], // 36 => 161 |
|
| 77 | - [20528, 15936, 11408, 8768], // 37 => 165 |
|
| 78 | - [21616, 16816, 12016, 9136], // 38 => 169 |
|
| 79 | - [22496, 17728, 12656, 9776], // 39 => 173 |
|
| 40 | + [null, null, null, null], // 0 => will be ignored, index starts at 1 |
|
| 41 | + [152, 128, 104, 72], // 1 => 21 |
|
| 42 | + [272, 224, 176, 128], // 2 => 25 |
|
| 43 | + [440, 352, 272, 208], // 3 => 29 |
|
| 44 | + [640, 512, 384, 288], // 4 => 33 |
|
| 45 | + [864, 688, 496, 368], // 5 => 37 |
|
| 46 | + [1088, 864, 608, 480], // 6 => 41 |
|
| 47 | + [1248, 992, 704, 528], // 7 => 45 |
|
| 48 | + [1552, 1232, 880, 688], // 8 => 49 |
|
| 49 | + [1856, 1456, 1056, 800], // 9 => 53 |
|
| 50 | + [2192, 1728, 1232, 976], // 10 => 57 |
|
| 51 | + [2592, 2032, 1440, 1120], // 11 => 61 |
|
| 52 | + [2960, 2320, 1648, 1264], // 12 => 65 |
|
| 53 | + [3424, 2672, 1952, 1440], // 13 => 69 NICE! |
|
| 54 | + [3688, 2920, 2088, 1576], // 14 => 73 |
|
| 55 | + [4184, 3320, 2360, 1784], // 15 => 77 |
|
| 56 | + [4712, 3624, 2600, 2024], // 16 => 81 |
|
| 57 | + [5176, 4056, 2936, 2264], // 17 => 85 |
|
| 58 | + [5768, 4504, 3176, 2504], // 18 => 89 |
|
| 59 | + [6360, 5016, 3560, 2728], // 19 => 93 |
|
| 60 | + [6888, 5352, 3880, 3080], // 20 => 97 |
|
| 61 | + [7456, 5712, 4096, 3248], // 21 => 101 |
|
| 62 | + [8048, 6256, 4544, 3536], // 22 => 105 |
|
| 63 | + [8752, 6880, 4912, 3712], // 23 => 109 |
|
| 64 | + [9392, 7312, 5312, 4112], // 24 => 113 |
|
| 65 | + [10208, 8000, 5744, 4304], // 25 => 117 |
|
| 66 | + [10960, 8496, 6032, 4768], // 26 => 121 |
|
| 67 | + [11744, 9024, 6464, 5024], // 27 => 125 |
|
| 68 | + [12248, 9544, 6968, 5288], // 28 => 129 |
|
| 69 | + [13048, 10136, 7288, 5608], // 29 => 133 |
|
| 70 | + [13880, 10984, 7880, 5960], // 30 => 137 |
|
| 71 | + [14744, 11640, 8264, 6344], // 31 => 141 |
|
| 72 | + [15640, 12328, 8920, 6760], // 32 => 145 |
|
| 73 | + [16568, 13048, 9368, 7208], // 33 => 149 |
|
| 74 | + [17528, 13800, 9848, 7688], // 34 => 153 |
|
| 75 | + [18448, 14496, 10288, 7888], // 35 => 157 |
|
| 76 | + [19472, 15312, 10832, 8432], // 36 => 161 |
|
| 77 | + [20528, 15936, 11408, 8768], // 37 => 165 |
|
| 78 | + [21616, 16816, 12016, 9136], // 38 => 169 |
|
| 79 | + [22496, 17728, 12656, 9776], // 39 => 173 |
|
| 80 | 80 | [23648, 18672, 13328, 10208], // 40 => 177 |
| 81 | 81 | ]; |
| 82 | 82 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * @var int[][] |
| 89 | 89 | */ |
| 90 | 90 | private const FORMAT_PATTERN = [ |
| 91 | - [ // L |
|
| 91 | + [// L |
|
| 92 | 92 | 0b111011111000100, |
| 93 | 93 | 0b111001011110011, |
| 94 | 94 | 0b111110110101010, |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | 0b110110001000001, |
| 99 | 99 | 0b110100101110110, |
| 100 | 100 | ], |
| 101 | - [ // M |
|
| 101 | + [// M |
|
| 102 | 102 | 0b101010000010010, |
| 103 | 103 | 0b101000100100101, |
| 104 | 104 | 0b101111001111100, |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | 0b100111110010111, |
| 109 | 109 | 0b100101010100000, |
| 110 | 110 | ], |
| 111 | - [ // Q |
|
| 111 | + [// Q |
|
| 112 | 112 | 0b011010101011111, |
| 113 | 113 | 0b011000001101000, |
| 114 | 114 | 0b011111100110001, |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | 0b010111011011010, |
| 119 | 119 | 0b010101111101101, |
| 120 | 120 | ], |
| 121 | - [ // H |
|
| 121 | + [// H |
|
| 122 | 122 | 0b001011010001001, |
| 123 | 123 | 0b001001110111110, |
| 124 | 124 | 0b001110011100111, |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | public function __construct(int $eccLevel){ |
| 149 | 149 | |
| 150 | - if((0b11 & $eccLevel) !== $eccLevel){ |
|
| 150 | + if((0b11&$eccLevel) !== $eccLevel){ |
|
| 151 | 151 | throw new QRCodeException('invalid ECC level'); |
| 152 | 152 | } |
| 153 | 153 | |
@@ -47,14 +47,14 @@ discard block |
||
| 47 | 47 | 18 => [6, 30, 56, 82], |
| 48 | 48 | 19 => [6, 30, 58, 86], |
| 49 | 49 | 20 => [6, 34, 62, 90], |
| 50 | - 21 => [6, 28, 50, 72, 94], |
|
| 51 | - 22 => [6, 26, 50, 74, 98], |
|
| 50 | + 21 => [6, 28, 50, 72, 94], |
|
| 51 | + 22 => [6, 26, 50, 74, 98], |
|
| 52 | 52 | 23 => [6, 30, 54, 78, 102], |
| 53 | 53 | 24 => [6, 28, 54, 80, 106], |
| 54 | 54 | 25 => [6, 32, 58, 84, 110], |
| 55 | 55 | 26 => [6, 30, 58, 86, 114], |
| 56 | 56 | 27 => [6, 34, 62, 90, 118], |
| 57 | - 28 => [6, 26, 50, 74, 98, 122], |
|
| 57 | + 28 => [6, 26, 50, 74, 98, 122], |
|
| 58 | 58 | 29 => [6, 30, 54, 78, 102, 126], |
| 59 | 59 | 30 => [6, 26, 52, 78, 104, 130], |
| 60 | 60 | 31 => [6, 30, 56, 82, 108, 134], |
@@ -119,46 +119,46 @@ discard block |
||
| 119 | 119 | * @see http://www.thonky.com/qr-code-tutorial/error-correction-table |
| 120 | 120 | */ |
| 121 | 121 | private const RSBLOCKS = [ |
| 122 | - 1 => [[ 7, [[ 1, 19], [ 0, 0]]], [10, [[ 1, 16], [ 0, 0]]], [13, [[ 1, 13], [ 0, 0]]], [17, [[ 1, 9], [ 0, 0]]]], |
|
| 123 | - 2 => [[10, [[ 1, 34], [ 0, 0]]], [16, [[ 1, 28], [ 0, 0]]], [22, [[ 1, 22], [ 0, 0]]], [28, [[ 1, 16], [ 0, 0]]]], |
|
| 124 | - 3 => [[15, [[ 1, 55], [ 0, 0]]], [26, [[ 1, 44], [ 0, 0]]], [18, [[ 2, 17], [ 0, 0]]], [22, [[ 2, 13], [ 0, 0]]]], |
|
| 125 | - 4 => [[20, [[ 1, 80], [ 0, 0]]], [18, [[ 2, 32], [ 0, 0]]], [26, [[ 2, 24], [ 0, 0]]], [16, [[ 4, 9], [ 0, 0]]]], |
|
| 126 | - 5 => [[26, [[ 1, 108], [ 0, 0]]], [24, [[ 2, 43], [ 0, 0]]], [18, [[ 2, 15], [ 2, 16]]], [22, [[ 2, 11], [ 2, 12]]]], |
|
| 127 | - 6 => [[18, [[ 2, 68], [ 0, 0]]], [16, [[ 4, 27], [ 0, 0]]], [24, [[ 4, 19], [ 0, 0]]], [28, [[ 4, 15], [ 0, 0]]]], |
|
| 128 | - 7 => [[20, [[ 2, 78], [ 0, 0]]], [18, [[ 4, 31], [ 0, 0]]], [18, [[ 2, 14], [ 4, 15]]], [26, [[ 4, 13], [ 1, 14]]]], |
|
| 129 | - 8 => [[24, [[ 2, 97], [ 0, 0]]], [22, [[ 2, 38], [ 2, 39]]], [22, [[ 4, 18], [ 2, 19]]], [26, [[ 4, 14], [ 2, 15]]]], |
|
| 130 | - 9 => [[30, [[ 2, 116], [ 0, 0]]], [22, [[ 3, 36], [ 2, 37]]], [20, [[ 4, 16], [ 4, 17]]], [24, [[ 4, 12], [ 4, 13]]]], |
|
| 131 | - 10 => [[18, [[ 2, 68], [ 2, 69]]], [26, [[ 4, 43], [ 1, 44]]], [24, [[ 6, 19], [ 2, 20]]], [28, [[ 6, 15], [ 2, 16]]]], |
|
| 132 | - 11 => [[20, [[ 4, 81], [ 0, 0]]], [30, [[ 1, 50], [ 4, 51]]], [28, [[ 4, 22], [ 4, 23]]], [24, [[ 3, 12], [ 8, 13]]]], |
|
| 133 | - 12 => [[24, [[ 2, 92], [ 2, 93]]], [22, [[ 6, 36], [ 2, 37]]], [26, [[ 4, 20], [ 6, 21]]], [28, [[ 7, 14], [ 4, 15]]]], |
|
| 134 | - 13 => [[26, [[ 4, 107], [ 0, 0]]], [22, [[ 8, 37], [ 1, 38]]], [24, [[ 8, 20], [ 4, 21]]], [22, [[12, 11], [ 4, 12]]]], |
|
| 135 | - 14 => [[30, [[ 3, 115], [ 1, 116]]], [24, [[ 4, 40], [ 5, 41]]], [20, [[11, 16], [ 5, 17]]], [24, [[11, 12], [ 5, 13]]]], |
|
| 136 | - 15 => [[22, [[ 5, 87], [ 1, 88]]], [24, [[ 5, 41], [ 5, 42]]], [30, [[ 5, 24], [ 7, 25]]], [24, [[11, 12], [ 7, 13]]]], |
|
| 137 | - 16 => [[24, [[ 5, 98], [ 1, 99]]], [28, [[ 7, 45], [ 3, 46]]], [24, [[15, 19], [ 2, 20]]], [30, [[ 3, 15], [13, 16]]]], |
|
| 138 | - 17 => [[28, [[ 1, 107], [ 5, 108]]], [28, [[10, 46], [ 1, 47]]], [28, [[ 1, 22], [15, 23]]], [28, [[ 2, 14], [17, 15]]]], |
|
| 139 | - 18 => [[30, [[ 5, 120], [ 1, 121]]], [26, [[ 9, 43], [ 4, 44]]], [28, [[17, 22], [ 1, 23]]], [28, [[ 2, 14], [19, 15]]]], |
|
| 140 | - 19 => [[28, [[ 3, 113], [ 4, 114]]], [26, [[ 3, 44], [11, 45]]], [26, [[17, 21], [ 4, 22]]], [26, [[ 9, 13], [16, 14]]]], |
|
| 141 | - 20 => [[28, [[ 3, 107], [ 5, 108]]], [26, [[ 3, 41], [13, 42]]], [30, [[15, 24], [ 5, 25]]], [28, [[15, 15], [10, 16]]]], |
|
| 142 | - 21 => [[28, [[ 4, 116], [ 4, 117]]], [26, [[17, 42], [ 0, 0]]], [28, [[17, 22], [ 6, 23]]], [30, [[19, 16], [ 6, 17]]]], |
|
| 143 | - 22 => [[28, [[ 2, 111], [ 7, 112]]], [28, [[17, 46], [ 0, 0]]], [30, [[ 7, 24], [16, 25]]], [24, [[34, 13], [ 0, 0]]]], |
|
| 144 | - 23 => [[30, [[ 4, 121], [ 5, 122]]], [28, [[ 4, 47], [14, 48]]], [30, [[11, 24], [14, 25]]], [30, [[16, 15], [14, 16]]]], |
|
| 145 | - 24 => [[30, [[ 6, 117], [ 4, 118]]], [28, [[ 6, 45], [14, 46]]], [30, [[11, 24], [16, 25]]], [30, [[30, 16], [ 2, 17]]]], |
|
| 146 | - 25 => [[26, [[ 8, 106], [ 4, 107]]], [28, [[ 8, 47], [13, 48]]], [30, [[ 7, 24], [22, 25]]], [30, [[22, 15], [13, 16]]]], |
|
| 147 | - 26 => [[28, [[10, 114], [ 2, 115]]], [28, [[19, 46], [ 4, 47]]], [28, [[28, 22], [ 6, 23]]], [30, [[33, 16], [ 4, 17]]]], |
|
| 148 | - 27 => [[30, [[ 8, 122], [ 4, 123]]], [28, [[22, 45], [ 3, 46]]], [30, [[ 8, 23], [26, 24]]], [30, [[12, 15], [28, 16]]]], |
|
| 149 | - 28 => [[30, [[ 3, 117], [10, 118]]], [28, [[ 3, 45], [23, 46]]], [30, [[ 4, 24], [31, 25]]], [30, [[11, 15], [31, 16]]]], |
|
| 150 | - 29 => [[30, [[ 7, 116], [ 7, 117]]], [28, [[21, 45], [ 7, 46]]], [30, [[ 1, 23], [37, 24]]], [30, [[19, 15], [26, 16]]]], |
|
| 151 | - 30 => [[30, [[ 5, 115], [10, 116]]], [28, [[19, 47], [10, 48]]], [30, [[15, 24], [25, 25]]], [30, [[23, 15], [25, 16]]]], |
|
| 152 | - 31 => [[30, [[13, 115], [ 3, 116]]], [28, [[ 2, 46], [29, 47]]], [30, [[42, 24], [ 1, 25]]], [30, [[23, 15], [28, 16]]]], |
|
| 153 | - 32 => [[30, [[17, 115], [ 0, 0]]], [28, [[10, 46], [23, 47]]], [30, [[10, 24], [35, 25]]], [30, [[19, 15], [35, 16]]]], |
|
| 154 | - 33 => [[30, [[17, 115], [ 1, 116]]], [28, [[14, 46], [21, 47]]], [30, [[29, 24], [19, 25]]], [30, [[11, 15], [46, 16]]]], |
|
| 155 | - 34 => [[30, [[13, 115], [ 6, 116]]], [28, [[14, 46], [23, 47]]], [30, [[44, 24], [ 7, 25]]], [30, [[59, 16], [ 1, 17]]]], |
|
| 156 | - 35 => [[30, [[12, 121], [ 7, 122]]], [28, [[12, 47], [26, 48]]], [30, [[39, 24], [14, 25]]], [30, [[22, 15], [41, 16]]]], |
|
| 157 | - 36 => [[30, [[ 6, 121], [14, 122]]], [28, [[ 6, 47], [34, 48]]], [30, [[46, 24], [10, 25]]], [30, [[ 2, 15], [64, 16]]]], |
|
| 158 | - 37 => [[30, [[17, 122], [ 4, 123]]], [28, [[29, 46], [14, 47]]], [30, [[49, 24], [10, 25]]], [30, [[24, 15], [46, 16]]]], |
|
| 159 | - 38 => [[30, [[ 4, 122], [18, 123]]], [28, [[13, 46], [32, 47]]], [30, [[48, 24], [14, 25]]], [30, [[42, 15], [32, 16]]]], |
|
| 160 | - 39 => [[30, [[20, 117], [ 4, 118]]], [28, [[40, 47], [ 7, 48]]], [30, [[43, 24], [22, 25]]], [30, [[10, 15], [67, 16]]]], |
|
| 161 | - 40 => [[30, [[19, 118], [ 6, 119]]], [28, [[18, 47], [31, 48]]], [30, [[34, 24], [34, 25]]], [30, [[20, 15], [61, 16]]]], |
|
| 122 | + 1 => [[7, [[1, 19], [0, 0]]], [10, [[1, 16], [0, 0]]], [13, [[1, 13], [0, 0]]], [17, [[1, 9], [0, 0]]]], |
|
| 123 | + 2 => [[10, [[1, 34], [0, 0]]], [16, [[1, 28], [0, 0]]], [22, [[1, 22], [0, 0]]], [28, [[1, 16], [0, 0]]]], |
|
| 124 | + 3 => [[15, [[1, 55], [0, 0]]], [26, [[1, 44], [0, 0]]], [18, [[2, 17], [0, 0]]], [22, [[2, 13], [0, 0]]]], |
|
| 125 | + 4 => [[20, [[1, 80], [0, 0]]], [18, [[2, 32], [0, 0]]], [26, [[2, 24], [0, 0]]], [16, [[4, 9], [0, 0]]]], |
|
| 126 | + 5 => [[26, [[1, 108], [0, 0]]], [24, [[2, 43], [0, 0]]], [18, [[2, 15], [2, 16]]], [22, [[2, 11], [2, 12]]]], |
|
| 127 | + 6 => [[18, [[2, 68], [0, 0]]], [16, [[4, 27], [0, 0]]], [24, [[4, 19], [0, 0]]], [28, [[4, 15], [0, 0]]]], |
|
| 128 | + 7 => [[20, [[2, 78], [0, 0]]], [18, [[4, 31], [0, 0]]], [18, [[2, 14], [4, 15]]], [26, [[4, 13], [1, 14]]]], |
|
| 129 | + 8 => [[24, [[2, 97], [0, 0]]], [22, [[2, 38], [2, 39]]], [22, [[4, 18], [2, 19]]], [26, [[4, 14], [2, 15]]]], |
|
| 130 | + 9 => [[30, [[2, 116], [0, 0]]], [22, [[3, 36], [2, 37]]], [20, [[4, 16], [4, 17]]], [24, [[4, 12], [4, 13]]]], |
|
| 131 | + 10 => [[18, [[2, 68], [2, 69]]], [26, [[4, 43], [1, 44]]], [24, [[6, 19], [2, 20]]], [28, [[6, 15], [2, 16]]]], |
|
| 132 | + 11 => [[20, [[4, 81], [0, 0]]], [30, [[1, 50], [4, 51]]], [28, [[4, 22], [4, 23]]], [24, [[3, 12], [8, 13]]]], |
|
| 133 | + 12 => [[24, [[2, 92], [2, 93]]], [22, [[6, 36], [2, 37]]], [26, [[4, 20], [6, 21]]], [28, [[7, 14], [4, 15]]]], |
|
| 134 | + 13 => [[26, [[4, 107], [0, 0]]], [22, [[8, 37], [1, 38]]], [24, [[8, 20], [4, 21]]], [22, [[12, 11], [4, 12]]]], |
|
| 135 | + 14 => [[30, [[3, 115], [1, 116]]], [24, [[4, 40], [5, 41]]], [20, [[11, 16], [5, 17]]], [24, [[11, 12], [5, 13]]]], |
|
| 136 | + 15 => [[22, [[5, 87], [1, 88]]], [24, [[5, 41], [5, 42]]], [30, [[5, 24], [7, 25]]], [24, [[11, 12], [7, 13]]]], |
|
| 137 | + 16 => [[24, [[5, 98], [1, 99]]], [28, [[7, 45], [3, 46]]], [24, [[15, 19], [2, 20]]], [30, [[3, 15], [13, 16]]]], |
|
| 138 | + 17 => [[28, [[1, 107], [5, 108]]], [28, [[10, 46], [1, 47]]], [28, [[1, 22], [15, 23]]], [28, [[2, 14], [17, 15]]]], |
|
| 139 | + 18 => [[30, [[5, 120], [1, 121]]], [26, [[9, 43], [4, 44]]], [28, [[17, 22], [1, 23]]], [28, [[2, 14], [19, 15]]]], |
|
| 140 | + 19 => [[28, [[3, 113], [4, 114]]], [26, [[3, 44], [11, 45]]], [26, [[17, 21], [4, 22]]], [26, [[9, 13], [16, 14]]]], |
|
| 141 | + 20 => [[28, [[3, 107], [5, 108]]], [26, [[3, 41], [13, 42]]], [30, [[15, 24], [5, 25]]], [28, [[15, 15], [10, 16]]]], |
|
| 142 | + 21 => [[28, [[4, 116], [4, 117]]], [26, [[17, 42], [0, 0]]], [28, [[17, 22], [6, 23]]], [30, [[19, 16], [6, 17]]]], |
|
| 143 | + 22 => [[28, [[2, 111], [7, 112]]], [28, [[17, 46], [0, 0]]], [30, [[7, 24], [16, 25]]], [24, [[34, 13], [0, 0]]]], |
|
| 144 | + 23 => [[30, [[4, 121], [5, 122]]], [28, [[4, 47], [14, 48]]], [30, [[11, 24], [14, 25]]], [30, [[16, 15], [14, 16]]]], |
|
| 145 | + 24 => [[30, [[6, 117], [4, 118]]], [28, [[6, 45], [14, 46]]], [30, [[11, 24], [16, 25]]], [30, [[30, 16], [2, 17]]]], |
|
| 146 | + 25 => [[26, [[8, 106], [4, 107]]], [28, [[8, 47], [13, 48]]], [30, [[7, 24], [22, 25]]], [30, [[22, 15], [13, 16]]]], |
|
| 147 | + 26 => [[28, [[10, 114], [2, 115]]], [28, [[19, 46], [4, 47]]], [28, [[28, 22], [6, 23]]], [30, [[33, 16], [4, 17]]]], |
|
| 148 | + 27 => [[30, [[8, 122], [4, 123]]], [28, [[22, 45], [3, 46]]], [30, [[8, 23], [26, 24]]], [30, [[12, 15], [28, 16]]]], |
|
| 149 | + 28 => [[30, [[3, 117], [10, 118]]], [28, [[3, 45], [23, 46]]], [30, [[4, 24], [31, 25]]], [30, [[11, 15], [31, 16]]]], |
|
| 150 | + 29 => [[30, [[7, 116], [7, 117]]], [28, [[21, 45], [7, 46]]], [30, [[1, 23], [37, 24]]], [30, [[19, 15], [26, 16]]]], |
|
| 151 | + 30 => [[30, [[5, 115], [10, 116]]], [28, [[19, 47], [10, 48]]], [30, [[15, 24], [25, 25]]], [30, [[23, 15], [25, 16]]]], |
|
| 152 | + 31 => [[30, [[13, 115], [3, 116]]], [28, [[2, 46], [29, 47]]], [30, [[42, 24], [1, 25]]], [30, [[23, 15], [28, 16]]]], |
|
| 153 | + 32 => [[30, [[17, 115], [0, 0]]], [28, [[10, 46], [23, 47]]], [30, [[10, 24], [35, 25]]], [30, [[19, 15], [35, 16]]]], |
|
| 154 | + 33 => [[30, [[17, 115], [1, 116]]], [28, [[14, 46], [21, 47]]], [30, [[29, 24], [19, 25]]], [30, [[11, 15], [46, 16]]]], |
|
| 155 | + 34 => [[30, [[13, 115], [6, 116]]], [28, [[14, 46], [23, 47]]], [30, [[44, 24], [7, 25]]], [30, [[59, 16], [1, 17]]]], |
|
| 156 | + 35 => [[30, [[12, 121], [7, 122]]], [28, [[12, 47], [26, 48]]], [30, [[39, 24], [14, 25]]], [30, [[22, 15], [41, 16]]]], |
|
| 157 | + 36 => [[30, [[6, 121], [14, 122]]], [28, [[6, 47], [34, 48]]], [30, [[46, 24], [10, 25]]], [30, [[2, 15], [64, 16]]]], |
|
| 158 | + 37 => [[30, [[17, 122], [4, 123]]], [28, [[29, 46], [14, 47]]], [30, [[49, 24], [10, 25]]], [30, [[24, 15], [46, 16]]]], |
|
| 159 | + 38 => [[30, [[4, 122], [18, 123]]], [28, [[13, 46], [32, 47]]], [30, [[48, 24], [14, 25]]], [30, [[42, 15], [32, 16]]]], |
|
| 160 | + 39 => [[30, [[20, 117], [4, 118]]], [28, [[40, 47], [7, 48]]], [30, [[43, 24], [22, 25]]], [30, [[10, 15], [67, 16]]]], |
|
| 161 | + 40 => [[30, [[19, 118], [6, 119]]], [28, [[18, 47], [31, 48]]], [30, [[34, 24], [34, 25]]], [30, [[20, 15], [61, 16]]]], |
|
| 162 | 162 | ]; |
| 163 | 163 | |
| 164 | 164 | private const TOTAL_CODEWORDS = [ |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | /** |
| 248 | 248 | * the version pattern for the given version |
| 249 | 249 | */ |
| 250 | - public function getVersionPattern():?int{ |
|
| 250 | + public function getVersionPattern(): ?int{ |
|
| 251 | 251 | return self::VERSION_PATTERN[$this->version] ?? null; |
| 252 | 252 | } |
| 253 | 253 | |