@@ -231,7 +231,7 @@ |
||
231 | 231 | * |
232 | 232 | * @see \chillerlan\QRCode\QROptions::$imageTransparencyBG |
233 | 233 | * @see https://github.com/chillerlan/php-qrcode/discussions/121 |
234 | - */ |
|
234 | + */ |
|
235 | 235 | protected bool $imageTransparent = true; |
236 | 236 | |
237 | 237 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | /** |
39 | 39 | * Read count (bits) |
40 | 40 | */ |
41 | - private int $bitsRead = 0; |
|
41 | + private int $bitsRead = 0; |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * BitBuffer constructor. |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $toRead = min($numBits, $bitsLeft); |
125 | 125 | $bitsToNotRead = $bitsLeft - $toRead; |
126 | 126 | $mask = (0xff >> (8 - $toRead)) << $bitsToNotRead; |
127 | - $result = ($this->buffer[$this->bytesRead] & $mask) >> $bitsToNotRead; |
|
127 | + $result = ($this->buffer[$this->bytesRead]&$mask) >> $bitsToNotRead; |
|
128 | 128 | $numBits -= $toRead; |
129 | 129 | $this->bitsRead += $toRead; |
130 | 130 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | if($numBits > 0){ |
139 | 139 | |
140 | 140 | while($numBits >= 8){ |
141 | - $result = ($result << 8) | ($this->buffer[$this->bytesRead] & 0xff); |
|
141 | + $result = ($result << 8)|($this->buffer[$this->bytesRead] & 0xff); |
|
142 | 142 | $this->bytesRead++; |
143 | 143 | $numBits -= 8; |
144 | 144 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | if($numBits > 0){ |
148 | 148 | $bitsToNotRead = 8 - $numBits; |
149 | 149 | $mask = (0xff >> $bitsToNotRead) << $bitsToNotRead; |
150 | - $result = ($result << $numBits) | (($this->buffer[$this->bytesRead] & $mask) >> $bitsToNotRead); |
|
150 | + $result = ($result << $numBits)|(($this->buffer[$this->bytesRead]&$mask) >> $bitsToNotRead); |
|
151 | 151 | $this->bitsRead += $numBits; |
152 | 152 | } |
153 | 153 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | while($i + 1 < $len){ |
65 | - $c = ((0xff & ord($string[$i])) << 8) | (0xff & ord($string[$i + 1])); |
|
65 | + $c = ((0xff & ord($string[$i])) << 8)|(0xff & ord($string[$i + 1])); |
|
66 | 66 | |
67 | 67 | if(!($c >= 0x8140 && $c <= 0x9ffc) && !($c >= 0xe040 && $c <= 0xebbf)){ |
68 | 68 | return false; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $len = strlen($this->data); |
90 | 90 | |
91 | 91 | for($i = 0; $i + 1 < $len; $i += 2){ |
92 | - $c = ((0xff & ord($this->data[$i])) << 8) | (0xff & ord($this->data[$i + 1])); |
|
92 | + $c = ((0xff & ord($this->data[$i])) << 8)|(0xff & ord($this->data[$i + 1])); |
|
93 | 93 | |
94 | 94 | if($c >= 0x8140 && $c <= 0x9ffC){ |
95 | 95 | $c -= 0x8140; |
@@ -128,15 +128,15 @@ discard block |
||
128 | 128 | while($length > 0){ |
129 | 129 | // Each 13 bits encodes a 2-byte character |
130 | 130 | $twoBytes = $bitBuffer->read(13); |
131 | - $assembledTwoBytes = ((int)($twoBytes / 0x0c0) << 8) | ($twoBytes % 0x0c0); |
|
131 | + $assembledTwoBytes = ((int)($twoBytes / 0x0c0) << 8)|($twoBytes % 0x0c0); |
|
132 | 132 | |
133 | 133 | $assembledTwoBytes += ($assembledTwoBytes < 0x01f00) |
134 | 134 | ? 0x08140 // In the 0x8140 to 0x9FFC range |
135 | 135 | : 0x0c140; // In the 0xE040 to 0xEBBF range |
136 | 136 | |
137 | 137 | $buffer[$offset] = chr(0xff & ($assembledTwoBytes >> 8)); |
138 | - $buffer[$offset + 1] = chr(0xff & $assembledTwoBytes); |
|
139 | - $offset += 2; |
|
138 | + $buffer[$offset + 1] = chr(0xff&$assembledTwoBytes); |
|
139 | + $offset += 2; |
|
140 | 140 | $length--; |
141 | 141 | } |
142 | 142 |
@@ -67,12 +67,12 @@ |
||
67 | 67 | |
68 | 68 | if(($firstByte & 0xc0) === 0x80){ |
69 | 69 | // two bytes |
70 | - return new ECICharset((($firstByte & 0x3f) << 8) | $bitBuffer->read(8)); |
|
70 | + return new ECICharset((($firstByte & 0x3f) << 8)|$bitBuffer->read(8)); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | if(($firstByte & 0xe0) === 0xC0){ |
74 | 74 | // three bytes |
75 | - return new ECICharset((($firstByte & 0x1f) << 16) | $bitBuffer->read(16)); |
|
75 | + return new ECICharset((($firstByte & 0x1f) << 16)|$bitBuffer->read(16)); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | throw new QRCodeDataException('error decoding ECI value'); |
@@ -153,7 +153,8 @@ |
||
153 | 153 | } |
154 | 154 | } |
155 | 155 | // @codeCoverageIgnoreStart |
156 | - catch(Throwable $aioobe){//ArrayIndexOutOfBoundsException |
|
156 | + catch(Throwable $aioobe){ |
|
157 | +//ArrayIndexOutOfBoundsException |
|
157 | 158 | // This feels wrong, but, sometimes if the finder patterns are misidentified, the resulting |
158 | 159 | // transform gets "twisted" such that it maps a straight line of points to a set of points |
159 | 160 | // whose endpoints are in bounds, but others are not. There is probably some mathematical |
@@ -105,7 +105,7 @@ |
||
105 | 105 | [$numEccCodewords, $eccBlocks] = $this->version->getRSBlocks($this->eccLevel); |
106 | 106 | |
107 | 107 | // Now establish DataBlocks of the appropriate size and number of data codewords |
108 | - $result = [];//new DataBlock[$totalBlocks]; |
|
108 | + $result = []; //new DataBlock[$totalBlocks]; |
|
109 | 109 | $numResultBlocks = 0; |
110 | 110 | |
111 | 111 | foreach($eccBlocks as $blockData){ |
@@ -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; |
@@ -85,7 +85,8 @@ |
||
85 | 85 | |
86 | 86 | if($this->matrix->check($j, $i)){ |
87 | 87 | // Black pixel |
88 | - if($currentState === 1){ // Counting black pixels |
|
88 | + if($currentState === 1){ |
|
89 | +// Counting black pixels |
|
89 | 90 | $stateCount[$currentState]++; |
90 | 91 | } |
91 | 92 | // Counting white pixels |
@@ -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; |