@@ -129,7 +129,7 @@ |
||
129 | 129 | |
130 | 130 | // scale down to the expected size |
131 | 131 | if($this->options->drawCircularModules && $this->options->scale <= 20){ |
132 | - $this->image = imagescale($this->image, $this->length/10, $this->length/10, IMG_BICUBIC); |
|
132 | + $this->image = imagescale($this->image, $this->length / 10, $this->length / 10, IMG_BICUBIC); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | if($this->options->returnResource){ |
@@ -37,45 +37,45 @@ discard block |
||
37 | 37 | */ |
38 | 38 | private const MAX_BITS = [ |
39 | 39 | // v => [ L, M, Q, H] // modules |
40 | - 1 => [ 152, 128, 104, 72], // 21 |
|
41 | - 2 => [ 272, 224, 176, 128], // 25 |
|
42 | - 3 => [ 440, 352, 272, 208], // 29 |
|
43 | - 4 => [ 640, 512, 384, 288], // 33 |
|
44 | - 5 => [ 864, 688, 496, 368], // 37 |
|
45 | - 6 => [ 1088, 864, 608, 480], // 41 |
|
46 | - 7 => [ 1248, 992, 704, 528], // 45 |
|
47 | - 8 => [ 1552, 1232, 880, 688], // 49 |
|
48 | - 9 => [ 1856, 1456, 1056, 800], // 53 |
|
49 | - 10 => [ 2192, 1728, 1232, 976], // 57 |
|
50 | - 11 => [ 2592, 2032, 1440, 1120], // 61 |
|
51 | - 12 => [ 2960, 2320, 1648, 1264], // 65 |
|
52 | - 13 => [ 3424, 2672, 1952, 1440], // 69 NICE! |
|
53 | - 14 => [ 3688, 2920, 2088, 1576], // 73 |
|
54 | - 15 => [ 4184, 3320, 2360, 1784], // 77 |
|
55 | - 16 => [ 4712, 3624, 2600, 2024], // 81 |
|
56 | - 17 => [ 5176, 4056, 2936, 2264], // 85 |
|
57 | - 18 => [ 5768, 4504, 3176, 2504], // 89 |
|
58 | - 19 => [ 6360, 5016, 3560, 2728], // 93 |
|
59 | - 20 => [ 6888, 5352, 3880, 3080], // 97 |
|
60 | - 21 => [ 7456, 5712, 4096, 3248], // 101 |
|
61 | - 22 => [ 8048, 6256, 4544, 3536], // 105 |
|
62 | - 23 => [ 8752, 6880, 4912, 3712], // 109 |
|
63 | - 24 => [ 9392, 7312, 5312, 4112], // 113 |
|
64 | - 25 => [10208, 8000, 5744, 4304], // 117 |
|
65 | - 26 => [10960, 8496, 6032, 4768], // 121 |
|
66 | - 27 => [11744, 9024, 6464, 5024], // 125 |
|
67 | - 28 => [12248, 9544, 6968, 5288], // 129 |
|
68 | - 29 => [13048, 10136, 7288, 5608], // 133 |
|
69 | - 30 => [13880, 10984, 7880, 5960], // 137 |
|
70 | - 31 => [14744, 11640, 8264, 6344], // 141 |
|
71 | - 32 => [15640, 12328, 8920, 6760], // 145 |
|
72 | - 33 => [16568, 13048, 9368, 7208], // 149 |
|
73 | - 34 => [17528, 13800, 9848, 7688], // 153 |
|
74 | - 35 => [18448, 14496, 10288, 7888], // 157 |
|
75 | - 36 => [19472, 15312, 10832, 8432], // 161 |
|
76 | - 37 => [20528, 15936, 11408, 8768], // 165 |
|
77 | - 38 => [21616, 16816, 12016, 9136], // 169 |
|
78 | - 39 => [22496, 17728, 12656, 9776], // 173 |
|
40 | + 1 => [152, 128, 104, 72], // 21 |
|
41 | + 2 => [272, 224, 176, 128], // 25 |
|
42 | + 3 => [440, 352, 272, 208], // 29 |
|
43 | + 4 => [640, 512, 384, 288], // 33 |
|
44 | + 5 => [864, 688, 496, 368], // 37 |
|
45 | + 6 => [1088, 864, 608, 480], // 41 |
|
46 | + 7 => [1248, 992, 704, 528], // 45 |
|
47 | + 8 => [1552, 1232, 880, 688], // 49 |
|
48 | + 9 => [1856, 1456, 1056, 800], // 53 |
|
49 | + 10 => [2192, 1728, 1232, 976], // 57 |
|
50 | + 11 => [2592, 2032, 1440, 1120], // 61 |
|
51 | + 12 => [2960, 2320, 1648, 1264], // 65 |
|
52 | + 13 => [3424, 2672, 1952, 1440], // 69 NICE! |
|
53 | + 14 => [3688, 2920, 2088, 1576], // 73 |
|
54 | + 15 => [4184, 3320, 2360, 1784], // 77 |
|
55 | + 16 => [4712, 3624, 2600, 2024], // 81 |
|
56 | + 17 => [5176, 4056, 2936, 2264], // 85 |
|
57 | + 18 => [5768, 4504, 3176, 2504], // 89 |
|
58 | + 19 => [6360, 5016, 3560, 2728], // 93 |
|
59 | + 20 => [6888, 5352, 3880, 3080], // 97 |
|
60 | + 21 => [7456, 5712, 4096, 3248], // 101 |
|
61 | + 22 => [8048, 6256, 4544, 3536], // 105 |
|
62 | + 23 => [8752, 6880, 4912, 3712], // 109 |
|
63 | + 24 => [9392, 7312, 5312, 4112], // 113 |
|
64 | + 25 => [10208, 8000, 5744, 4304], // 117 |
|
65 | + 26 => [10960, 8496, 6032, 4768], // 121 |
|
66 | + 27 => [11744, 9024, 6464, 5024], // 125 |
|
67 | + 28 => [12248, 9544, 6968, 5288], // 129 |
|
68 | + 29 => [13048, 10136, 7288, 5608], // 133 |
|
69 | + 30 => [13880, 10984, 7880, 5960], // 137 |
|
70 | + 31 => [14744, 11640, 8264, 6344], // 141 |
|
71 | + 32 => [15640, 12328, 8920, 6760], // 145 |
|
72 | + 33 => [16568, 13048, 9368, 7208], // 149 |
|
73 | + 34 => [17528, 13800, 9848, 7688], // 153 |
|
74 | + 35 => [18448, 14496, 10288, 7888], // 157 |
|
75 | + 36 => [19472, 15312, 10832, 8432], // 161 |
|
76 | + 37 => [20528, 15936, 11408, 8768], // 165 |
|
77 | + 38 => [21616, 16816, 12016, 9136], // 169 |
|
78 | + 39 => [22496, 17728, 12656, 9776], // 173 |
|
79 | 79 | 40 => [23648, 18672, 13328, 10208], // 177 |
80 | 80 | ]; |
81 | 81 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @var int[][] |
88 | 88 | */ |
89 | 89 | private const FORMAT_PATTERN = [ |
90 | - [ // L |
|
90 | + [// L |
|
91 | 91 | 0b111011111000100, |
92 | 92 | 0b111001011110011, |
93 | 93 | 0b111110110101010, |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | 0b110110001000001, |
98 | 98 | 0b110100101110110, |
99 | 99 | ], |
100 | - [ // M |
|
100 | + [// M |
|
101 | 101 | 0b101010000010010, |
102 | 102 | 0b101000100100101, |
103 | 103 | 0b101111001111100, |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | 0b100111110010111, |
108 | 108 | 0b100101010100000, |
109 | 109 | ], |
110 | - [ // Q |
|
110 | + [// Q |
|
111 | 111 | 0b011010101011111, |
112 | 112 | 0b011000001101000, |
113 | 113 | 0b011111100110001, |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | 0b010111011011010, |
118 | 118 | 0b010101111101101, |
119 | 119 | ], |
120 | - [ // H |
|
120 | + [// H |
|
121 | 121 | 0b001011010001001, |
122 | 122 | 0b001001110111110, |
123 | 123 | 0b001110011100111, |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function __construct(int $eccLevel){ |
148 | 148 | |
149 | - if((0b11 & $eccLevel) !== $eccLevel){ |
|
149 | + if((0b11&$eccLevel) !== $eccLevel){ |
|
150 | 150 | throw new QRCodeException('invalid ECC level'); |
151 | 151 | } |
152 | 152 |
@@ -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 |