@@ -37,46 +37,46 @@ discard block |
||
37 | 37 | */ |
38 | 38 | private const MAX_BITS = [ |
39 | 39 | // [ L, M, Q, H] // v => modules |
40 | - [ 0, 0, 0, 0], // 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 | + [0, 0, 0, 0], // 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, |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function __construct(int $eccLevel){ |
152 | 152 | |
153 | - if((0b11 & $eccLevel) !== $eccLevel){ |
|
153 | + if((0b11&$eccLevel) !== $eccLevel){ |
|
154 | 154 | throw new QRCodeException('invalid ECC level'); |
155 | 155 | } |
156 | 156 |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | */ |
78 | 78 | protected const neighbours = [ |
79 | 79 | 0b00000001 => [-1, -1], |
80 | - 0b00000010 => [ 0, -1], |
|
81 | - 0b00000100 => [ 1, -1], |
|
82 | - 0b00001000 => [ 1, 0], |
|
83 | - 0b00010000 => [ 1, 1], |
|
84 | - 0b00100000 => [ 0, 1], |
|
85 | - 0b01000000 => [-1, 1], |
|
86 | - 0b10000000 => [-1, 0], |
|
80 | + 0b00000010 => [0, -1], |
|
81 | + 0b00000100 => [1, -1], |
|
82 | + 0b00001000 => [1, 0], |
|
83 | + 0b00010000 => [1, 1], |
|
84 | + 0b00100000 => [0, 1], |
|
85 | + 0b01000000 => [-1, 1], |
|
86 | + 0b10000000 => [-1, 0], |
|
87 | 87 | ]; |
88 | 88 | |
89 | 89 | /** |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | /** |
183 | 183 | * Returns the current version number |
184 | 184 | */ |
185 | - public function getVersion():?Version{ |
|
185 | + public function getVersion(): ?Version{ |
|
186 | 186 | return $this->version; |
187 | 187 | } |
188 | 188 | |
@@ -191,14 +191,14 @@ discard block |
||
191 | 191 | * @see \chillerlan\QRCode\Data\QRMatrix::getVersion() |
192 | 192 | * @codeCoverageIgnore |
193 | 193 | */ |
194 | - public function version():?Version{ |
|
194 | + public function version(): ?Version{ |
|
195 | 195 | return $this->getVersion(); |
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
199 | 199 | * Returns the current ECC level |
200 | 200 | */ |
201 | - public function getEccLevel():?EccLevel{ |
|
201 | + public function getEccLevel(): ?EccLevel{ |
|
202 | 202 | return $this->eccLevel; |
203 | 203 | } |
204 | 204 | |
@@ -207,14 +207,14 @@ discard block |
||
207 | 207 | * @see \chillerlan\QRCode\Data\QRMatrix::getEccLevel() |
208 | 208 | * @codeCoverageIgnore |
209 | 209 | */ |
210 | - public function eccLevel():?EccLevel{ |
|
210 | + public function eccLevel(): ?EccLevel{ |
|
211 | 211 | return $this->getEccLevel(); |
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
215 | 215 | * Returns the current mask pattern |
216 | 216 | */ |
217 | - public function getMaskPattern():?MaskPattern{ |
|
217 | + public function getMaskPattern(): ?MaskPattern{ |
|
218 | 218 | return $this->maskPattern; |
219 | 219 | } |
220 | 220 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * @see \chillerlan\QRCode\Data\QRMatrix::getMaskPattern() |
224 | 224 | * @codeCoverageIgnore |
225 | 225 | */ |
226 | - public function maskPattern():?MaskPattern{ |
|
226 | + public function maskPattern(): ?MaskPattern{ |
|
227 | 227 | return $this->getMaskPattern(); |
228 | 228 | } |
229 | 229 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | $val = ($M_TYPE & 0x7ff); |
274 | 274 | |
275 | 275 | if($value === true){ |
276 | - $val = ($this::IS_DARK | ($val << 12) | $val); |
|
276 | + $val = ($this::IS_DARK|($val << 12)|$val); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | $this->matrix[$y][$x] = $val; |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | return false; |
308 | 308 | } |
309 | 309 | |
310 | - return ($val & $M_TYPE) === $M_TYPE; |
|
310 | + return ($val&$M_TYPE) === $M_TYPE; |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | |
324 | 324 | # printf("%024b\n%024b\n%024b\n\n", $M_TYPES, $val, (($val & $M_TYPES))); |
325 | 325 | |
326 | - return ($val & $M_TYPES & 0x7fffff) > 0; |
|
326 | + return ($val&$M_TYPES & 0x7fffff) > 0; |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -421,8 +421,8 @@ discard block |
||
421 | 421 | |
422 | 422 | for($c = 0; $c < 3; $c++){ |
423 | 423 | for($i = 0; $i < 8; $i++){ |
424 | - $this->set($h[$c][0] , ($h[$c][1] + $i), false, $this::M_SEPARATOR); |
|
425 | - $this->set(($v[$c][0] - $i), $v[$c][1] , false, $this::M_SEPARATOR); |
|
424 | + $this->set($h[$c][0], ($h[$c][1] + $i), false, $this::M_SEPARATOR); |
|
425 | + $this->set(($v[$c][0] - $i), $v[$c][1], false, $this::M_SEPARATOR); |
|
426 | 426 | } |
427 | 427 | } |
428 | 428 | |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | for($y = $startY; $y < $endY; $y++){ |
654 | 654 | for($x = $startX; $x < $endX; $x++){ |
655 | 655 | // out of bounds, skip |
656 | - if($x < $start || $y < $start ||$x >= $end || $y >= $end){ |
|
656 | + if($x < $start || $y < $start || $x >= $end || $y >= $end){ |
|
657 | 657 | continue; |
658 | 658 | } |
659 | 659 | |
@@ -721,12 +721,12 @@ discard block |
||
721 | 721 | foreach($this->matrix as $y => $row){ |
722 | 722 | foreach($row as $x => $val){ |
723 | 723 | // skip non-data modules |
724 | - if(($val & $this::M_DATA) !== $this::M_DATA){ |
|
724 | + if(($val&$this::M_DATA) !== $this::M_DATA){ |
|
725 | 725 | continue; |
726 | 726 | } |
727 | 727 | |
728 | 728 | if($mask($x, $y)){ |
729 | - $this->set($x, $y, ($val & $this::IS_DARK) !== $this::IS_DARK, $val); |
|
729 | + $this->set($x, $y, ($val&$this::IS_DARK) !== $this::IS_DARK, $val); |
|
730 | 730 | } |
731 | 731 | } |
732 | 732 | } |