@@ -18,16 +18,16 @@ discard block |
||
18 | 18 | */ |
19 | 19 | final class ECICharset{ |
20 | 20 | |
21 | - public const CP437 = 0; // Code page 437, DOS Latin US |
|
22 | - public const ISO_IEC_8859_1_GLI = 1; // GLI encoding with characters 0 to 127 identical to ISO/IEC 646 and characters 128 to 255 identical to ISO 8859-1 |
|
23 | - public const CP437_WO_GLI = 2; // An equivalent code table to CP437, without the return-to-GLI 0 logic |
|
24 | - public const ISO_IEC_8859_1 = 3; // Latin-1 (Default) |
|
25 | - public const ISO_IEC_8859_2 = 4; // Latin-2 |
|
26 | - public const ISO_IEC_8859_3 = 5; // Latin-3 |
|
27 | - public const ISO_IEC_8859_4 = 6; // Latin-4 |
|
28 | - public const ISO_IEC_8859_5 = 7; // Latin/Cyrillic |
|
29 | - public const ISO_IEC_8859_6 = 8; // Latin/Arabic |
|
30 | - public const ISO_IEC_8859_7 = 9; // Latin/Greek |
|
21 | + public const CP437 = 0; // Code page 437, DOS Latin US |
|
22 | + public const ISO_IEC_8859_1_GLI = 1; // GLI encoding with characters 0 to 127 identical to ISO/IEC 646 and characters 128 to 255 identical to ISO 8859-1 |
|
23 | + public const CP437_WO_GLI = 2; // An equivalent code table to CP437, without the return-to-GLI 0 logic |
|
24 | + public const ISO_IEC_8859_1 = 3; // Latin-1 (Default) |
|
25 | + public const ISO_IEC_8859_2 = 4; // Latin-2 |
|
26 | + public const ISO_IEC_8859_3 = 5; // Latin-3 |
|
27 | + public const ISO_IEC_8859_4 = 6; // Latin-4 |
|
28 | + public const ISO_IEC_8859_5 = 7; // Latin/Cyrillic |
|
29 | + public const ISO_IEC_8859_6 = 8; // Latin/Arabic |
|
30 | + public const ISO_IEC_8859_7 = 9; // Latin/Greek |
|
31 | 31 | public const ISO_IEC_8859_8 = 10; // Latin/Hebrew |
32 | 32 | public const ISO_IEC_8859_9 = 11; // Latin-5 |
33 | 33 | public const ISO_IEC_8859_10 = 12; // Latin-6 |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @see \mb_convert_encoding() |
118 | 118 | * @see \iconv() |
119 | 119 | */ |
120 | - public function getName():?string{ |
|
120 | + public function getName(): ?string{ |
|
121 | 121 | return self::MB_ENCODINGS[$this->charsetID]; |
122 | 122 | } |
123 | 123 |
@@ -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. |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | public function put(int $bits, int $length):self{ |
57 | 57 | |
58 | 58 | for($i = 0; $i < $length; $i++){ |
59 | - $this->putBit((($bits >> ($length - $i - 1)) & 1) === 1); |
|
59 | + $this->putBit((($bits >> ($length - $i - 1))&1) === 1); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | return $this; |
@@ -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 | } |
@@ -45,14 +45,14 @@ discard block |
||
45 | 45 | 18 => [6, 30, 56, 82], |
46 | 46 | 19 => [6, 30, 58, 86], |
47 | 47 | 20 => [6, 34, 62, 90], |
48 | - 21 => [6, 28, 50, 72, 94], |
|
49 | - 22 => [6, 26, 50, 74, 98], |
|
48 | + 21 => [6, 28, 50, 72, 94], |
|
49 | + 22 => [6, 26, 50, 74, 98], |
|
50 | 50 | 23 => [6, 30, 54, 78, 102], |
51 | 51 | 24 => [6, 28, 54, 80, 106], |
52 | 52 | 25 => [6, 32, 58, 84, 110], |
53 | 53 | 26 => [6, 30, 58, 86, 114], |
54 | 54 | 27 => [6, 34, 62, 90, 118], |
55 | - 28 => [6, 26, 50, 74, 98, 122], |
|
55 | + 28 => [6, 26, 50, 74, 98, 122], |
|
56 | 56 | 29 => [6, 30, 54, 78, 102, 126], |
57 | 57 | 30 => [6, 26, 52, 78, 104, 130], |
58 | 58 | 31 => [6, 30, 56, 82, 108, 134], |
@@ -118,48 +118,48 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @var int [][][] |
120 | 120 | */ |
121 | - private const MAX_LENGTH =[ |
|
121 | + private const MAX_LENGTH = [ |
|
122 | 122 | // v => [NUMERIC => [L, M, Q, H ], ALPHANUM => [L, M, Q, H], BINARY => [L, M, Q, H ], KANJI => [L, M, Q, H ]] |
123 | - 1 => [[ 41, 34, 27, 17], [ 25, 20, 16, 10], [ 17, 14, 11, 7], [ 10, 8, 7, 4]], |
|
124 | - 2 => [[ 77, 63, 48, 34], [ 47, 38, 29, 20], [ 32, 26, 20, 14], [ 20, 16, 12, 8]], |
|
125 | - 3 => [[ 127, 101, 77, 58], [ 77, 61, 47, 35], [ 53, 42, 32, 24], [ 32, 26, 20, 15]], |
|
126 | - 4 => [[ 187, 149, 111, 82], [ 114, 90, 67, 50], [ 78, 62, 46, 34], [ 48, 38, 28, 21]], |
|
127 | - 5 => [[ 255, 202, 144, 106], [ 154, 122, 87, 64], [ 106, 84, 60, 44], [ 65, 52, 37, 27]], |
|
128 | - 6 => [[ 322, 255, 178, 139], [ 195, 154, 108, 84], [ 134, 106, 74, 58], [ 82, 65, 45, 36]], |
|
129 | - 7 => [[ 370, 293, 207, 154], [ 224, 178, 125, 93], [ 154, 122, 86, 64], [ 95, 75, 53, 39]], |
|
130 | - 8 => [[ 461, 365, 259, 202], [ 279, 221, 157, 122], [ 192, 152, 108, 84], [ 118, 93, 66, 52]], |
|
131 | - 9 => [[ 552, 432, 312, 235], [ 335, 262, 189, 143], [ 230, 180, 130, 98], [ 141, 111, 80, 60]], |
|
132 | - 10 => [[ 652, 513, 364, 288], [ 395, 311, 221, 174], [ 271, 213, 151, 119], [ 167, 131, 93, 74]], |
|
133 | - 11 => [[ 772, 604, 427, 331], [ 468, 366, 259, 200], [ 321, 251, 177, 137], [ 198, 155, 109, 85]], |
|
134 | - 12 => [[ 883, 691, 489, 374], [ 535, 419, 296, 227], [ 367, 287, 203, 155], [ 226, 177, 125, 96]], |
|
135 | - 13 => [[1022, 796, 580, 427], [ 619, 483, 352, 259], [ 425, 331, 241, 177], [ 262, 204, 149, 109]], |
|
136 | - 14 => [[1101, 871, 621, 468], [ 667, 528, 376, 283], [ 458, 362, 258, 194], [ 282, 223, 159, 120]], |
|
137 | - 15 => [[1250, 991, 703, 530], [ 758, 600, 426, 321], [ 520, 412, 292, 220], [ 320, 254, 180, 136]], |
|
138 | - 16 => [[1408, 1082, 775, 602], [ 854, 656, 470, 365], [ 586, 450, 322, 250], [ 361, 277, 198, 154]], |
|
139 | - 17 => [[1548, 1212, 876, 674], [ 938, 734, 531, 408], [ 644, 504, 364, 280], [ 397, 310, 224, 173]], |
|
140 | - 18 => [[1725, 1346, 948, 746], [1046, 816, 574, 452], [ 718, 560, 394, 310], [ 442, 345, 243, 191]], |
|
141 | - 19 => [[1903, 1500, 1063, 813], [1153, 909, 644, 493], [ 792, 624, 442, 338], [ 488, 384, 272, 208]], |
|
142 | - 20 => [[2061, 1600, 1159, 919], [1249, 970, 702, 557], [ 858, 666, 482, 382], [ 528, 410, 297, 235]], |
|
143 | - 21 => [[2232, 1708, 1224, 969], [1352, 1035, 742, 587], [ 929, 711, 509, 403], [ 572, 438, 314, 248]], |
|
144 | - 22 => [[2409, 1872, 1358, 1056], [1460, 1134, 823, 640], [1003, 779, 565, 439], [ 618, 480, 348, 270]], |
|
145 | - 23 => [[2620, 2059, 1468, 1108], [1588, 1248, 890, 672], [1091, 857, 611, 461], [ 672, 528, 376, 284]], |
|
146 | - 24 => [[2812, 2188, 1588, 1228], [1704, 1326, 963, 744], [1171, 911, 661, 511], [ 721, 561, 407, 315]], |
|
147 | - 25 => [[3057, 2395, 1718, 1286], [1853, 1451, 1041, 779], [1273, 997, 715, 535], [ 784, 614, 440, 330]], |
|
148 | - 26 => [[3283, 2544, 1804, 1425], [1990, 1542, 1094, 864], [1367, 1059, 751, 593], [ 842, 652, 462, 365]], |
|
149 | - 27 => [[3517, 2701, 1933, 1501], [2132, 1637, 1172, 910], [1465, 1125, 805, 625], [ 902, 692, 496, 385]], |
|
150 | - 28 => [[3669, 2857, 2085, 1581], [2223, 1732, 1263, 958], [1528, 1190, 868, 658], [ 940, 732, 534, 405]], |
|
151 | - 29 => [[3909, 3035, 2181, 1677], [2369, 1839, 1322, 1016], [1628, 1264, 908, 698], [1002, 778, 559, 430]], |
|
152 | - 30 => [[4158, 3289, 2358, 1782], [2520, 1994, 1429, 1080], [1732, 1370, 982, 742], [1066, 843, 604, 457]], |
|
153 | - 31 => [[4417, 3486, 2473, 1897], [2677, 2113, 1499, 1150], [1840, 1452, 1030, 790], [1132, 894, 634, 486]], |
|
154 | - 32 => [[4686, 3693, 2670, 2022], [2840, 2238, 1618, 1226], [1952, 1538, 1112, 842], [1201, 947, 684, 518]], |
|
155 | - 33 => [[4965, 3909, 2805, 2157], [3009, 2369, 1700, 1307], [2068, 1628, 1168, 898], [1273, 1002, 719, 553]], |
|
156 | - 34 => [[5253, 4134, 2949, 2301], [3183, 2506, 1787, 1394], [2188, 1722, 1228, 958], [1347, 1060, 756, 590]], |
|
157 | - 35 => [[5529, 4343, 3081, 2361], [3351, 2632, 1867, 1431], [2303, 1809, 1283, 983], [1417, 1113, 790, 605]], |
|
158 | - 36 => [[5836, 4588, 3244, 2524], [3537, 2780, 1966, 1530], [2431, 1911, 1351, 1051], [1496, 1176, 832, 647]], |
|
159 | - 37 => [[6153, 4775, 3417, 2625], [3729, 2894, 2071, 1591], [2563, 1989, 1423, 1093], [1577, 1224, 876, 673]], |
|
160 | - 38 => [[6479, 5039, 3599, 2735], [3927, 3054, 2181, 1658], [2699, 2099, 1499, 1139], [1661, 1292, 923, 701]], |
|
161 | - 39 => [[6743, 5313, 3791, 2927], [4087, 3220, 2298, 1774], [2809, 2213, 1579, 1219], [1729, 1362, 972, 750]], |
|
162 | - 40 => [[7089, 5596, 3993, 3057], [4296, 3391, 2420, 1852], [2953, 2331, 1663, 1273], [1817, 1435, 1024, 784]], |
|
123 | + 1 => [[41, 34, 27, 17], [25, 20, 16, 10], [17, 14, 11, 7], [10, 8, 7, 4]], |
|
124 | + 2 => [[77, 63, 48, 34], [47, 38, 29, 20], [32, 26, 20, 14], [20, 16, 12, 8]], |
|
125 | + 3 => [[127, 101, 77, 58], [77, 61, 47, 35], [53, 42, 32, 24], [32, 26, 20, 15]], |
|
126 | + 4 => [[187, 149, 111, 82], [114, 90, 67, 50], [78, 62, 46, 34], [48, 38, 28, 21]], |
|
127 | + 5 => [[255, 202, 144, 106], [154, 122, 87, 64], [106, 84, 60, 44], [65, 52, 37, 27]], |
|
128 | + 6 => [[322, 255, 178, 139], [195, 154, 108, 84], [134, 106, 74, 58], [82, 65, 45, 36]], |
|
129 | + 7 => [[370, 293, 207, 154], [224, 178, 125, 93], [154, 122, 86, 64], [95, 75, 53, 39]], |
|
130 | + 8 => [[461, 365, 259, 202], [279, 221, 157, 122], [192, 152, 108, 84], [118, 93, 66, 52]], |
|
131 | + 9 => [[552, 432, 312, 235], [335, 262, 189, 143], [230, 180, 130, 98], [141, 111, 80, 60]], |
|
132 | + 10 => [[652, 513, 364, 288], [395, 311, 221, 174], [271, 213, 151, 119], [167, 131, 93, 74]], |
|
133 | + 11 => [[772, 604, 427, 331], [468, 366, 259, 200], [321, 251, 177, 137], [198, 155, 109, 85]], |
|
134 | + 12 => [[883, 691, 489, 374], [535, 419, 296, 227], [367, 287, 203, 155], [226, 177, 125, 96]], |
|
135 | + 13 => [[1022, 796, 580, 427], [619, 483, 352, 259], [425, 331, 241, 177], [262, 204, 149, 109]], |
|
136 | + 14 => [[1101, 871, 621, 468], [667, 528, 376, 283], [458, 362, 258, 194], [282, 223, 159, 120]], |
|
137 | + 15 => [[1250, 991, 703, 530], [758, 600, 426, 321], [520, 412, 292, 220], [320, 254, 180, 136]], |
|
138 | + 16 => [[1408, 1082, 775, 602], [854, 656, 470, 365], [586, 450, 322, 250], [361, 277, 198, 154]], |
|
139 | + 17 => [[1548, 1212, 876, 674], [938, 734, 531, 408], [644, 504, 364, 280], [397, 310, 224, 173]], |
|
140 | + 18 => [[1725, 1346, 948, 746], [1046, 816, 574, 452], [718, 560, 394, 310], [442, 345, 243, 191]], |
|
141 | + 19 => [[1903, 1500, 1063, 813], [1153, 909, 644, 493], [792, 624, 442, 338], [488, 384, 272, 208]], |
|
142 | + 20 => [[2061, 1600, 1159, 919], [1249, 970, 702, 557], [858, 666, 482, 382], [528, 410, 297, 235]], |
|
143 | + 21 => [[2232, 1708, 1224, 969], [1352, 1035, 742, 587], [929, 711, 509, 403], [572, 438, 314, 248]], |
|
144 | + 22 => [[2409, 1872, 1358, 1056], [1460, 1134, 823, 640], [1003, 779, 565, 439], [618, 480, 348, 270]], |
|
145 | + 23 => [[2620, 2059, 1468, 1108], [1588, 1248, 890, 672], [1091, 857, 611, 461], [672, 528, 376, 284]], |
|
146 | + 24 => [[2812, 2188, 1588, 1228], [1704, 1326, 963, 744], [1171, 911, 661, 511], [721, 561, 407, 315]], |
|
147 | + 25 => [[3057, 2395, 1718, 1286], [1853, 1451, 1041, 779], [1273, 997, 715, 535], [784, 614, 440, 330]], |
|
148 | + 26 => [[3283, 2544, 1804, 1425], [1990, 1542, 1094, 864], [1367, 1059, 751, 593], [842, 652, 462, 365]], |
|
149 | + 27 => [[3517, 2701, 1933, 1501], [2132, 1637, 1172, 910], [1465, 1125, 805, 625], [902, 692, 496, 385]], |
|
150 | + 28 => [[3669, 2857, 2085, 1581], [2223, 1732, 1263, 958], [1528, 1190, 868, 658], [940, 732, 534, 405]], |
|
151 | + 29 => [[3909, 3035, 2181, 1677], [2369, 1839, 1322, 1016], [1628, 1264, 908, 698], [1002, 778, 559, 430]], |
|
152 | + 30 => [[4158, 3289, 2358, 1782], [2520, 1994, 1429, 1080], [1732, 1370, 982, 742], [1066, 843, 604, 457]], |
|
153 | + 31 => [[4417, 3486, 2473, 1897], [2677, 2113, 1499, 1150], [1840, 1452, 1030, 790], [1132, 894, 634, 486]], |
|
154 | + 32 => [[4686, 3693, 2670, 2022], [2840, 2238, 1618, 1226], [1952, 1538, 1112, 842], [1201, 947, 684, 518]], |
|
155 | + 33 => [[4965, 3909, 2805, 2157], [3009, 2369, 1700, 1307], [2068, 1628, 1168, 898], [1273, 1002, 719, 553]], |
|
156 | + 34 => [[5253, 4134, 2949, 2301], [3183, 2506, 1787, 1394], [2188, 1722, 1228, 958], [1347, 1060, 756, 590]], |
|
157 | + 35 => [[5529, 4343, 3081, 2361], [3351, 2632, 1867, 1431], [2303, 1809, 1283, 983], [1417, 1113, 790, 605]], |
|
158 | + 36 => [[5836, 4588, 3244, 2524], [3537, 2780, 1966, 1530], [2431, 1911, 1351, 1051], [1496, 1176, 832, 647]], |
|
159 | + 37 => [[6153, 4775, 3417, 2625], [3729, 2894, 2071, 1591], [2563, 1989, 1423, 1093], [1577, 1224, 876, 673]], |
|
160 | + 38 => [[6479, 5039, 3599, 2735], [3927, 3054, 2181, 1658], [2699, 2099, 1499, 1139], [1661, 1292, 923, 701]], |
|
161 | + 39 => [[6743, 5313, 3791, 2927], [4087, 3220, 2298, 1774], [2809, 2213, 1579, 1219], [1729, 1362, 972, 750]], |
|
162 | + 40 => [[7089, 5596, 3993, 3057], [4296, 3391, 2420, 1852], [2953, 2331, 1663, 1273], [1817, 1435, 1024, 784]], |
|
163 | 163 | ]; |
164 | 164 | |
165 | 165 | /** |
@@ -168,46 +168,46 @@ discard block |
||
168 | 168 | * @see http://www.thonky.com/qr-code-tutorial/error-correction-table |
169 | 169 | */ |
170 | 170 | private const RSBLOCKS = [ |
171 | - 1 => [[ 7, [[ 1, 19], [ 0, 0]]], [10, [[ 1, 16], [ 0, 0]]], [13, [[ 1, 13], [ 0, 0]]], [17, [[ 1, 9], [ 0, 0]]]], |
|
172 | - 2 => [[10, [[ 1, 34], [ 0, 0]]], [16, [[ 1, 28], [ 0, 0]]], [22, [[ 1, 22], [ 0, 0]]], [28, [[ 1, 16], [ 0, 0]]]], |
|
173 | - 3 => [[15, [[ 1, 55], [ 0, 0]]], [26, [[ 1, 44], [ 0, 0]]], [18, [[ 2, 17], [ 0, 0]]], [22, [[ 2, 13], [ 0, 0]]]], |
|
174 | - 4 => [[20, [[ 1, 80], [ 0, 0]]], [18, [[ 2, 32], [ 0, 0]]], [26, [[ 2, 24], [ 0, 0]]], [16, [[ 4, 9], [ 0, 0]]]], |
|
175 | - 5 => [[26, [[ 1, 108], [ 0, 0]]], [24, [[ 2, 43], [ 0, 0]]], [18, [[ 2, 15], [ 2, 16]]], [22, [[ 2, 11], [ 2, 12]]]], |
|
176 | - 6 => [[18, [[ 2, 68], [ 0, 0]]], [16, [[ 4, 27], [ 0, 0]]], [24, [[ 4, 19], [ 0, 0]]], [28, [[ 4, 15], [ 0, 0]]]], |
|
177 | - 7 => [[20, [[ 2, 78], [ 0, 0]]], [18, [[ 4, 31], [ 0, 0]]], [18, [[ 2, 14], [ 4, 15]]], [26, [[ 4, 13], [ 1, 14]]]], |
|
178 | - 8 => [[24, [[ 2, 97], [ 0, 0]]], [22, [[ 2, 38], [ 2, 39]]], [22, [[ 4, 18], [ 2, 19]]], [26, [[ 4, 14], [ 2, 15]]]], |
|
179 | - 9 => [[30, [[ 2, 116], [ 0, 0]]], [22, [[ 3, 36], [ 2, 37]]], [20, [[ 4, 16], [ 4, 17]]], [24, [[ 4, 12], [ 4, 13]]]], |
|
180 | - 10 => [[18, [[ 2, 68], [ 2, 69]]], [26, [[ 4, 43], [ 1, 44]]], [24, [[ 6, 19], [ 2, 20]]], [28, [[ 6, 15], [ 2, 16]]]], |
|
181 | - 11 => [[20, [[ 4, 81], [ 0, 0]]], [30, [[ 1, 50], [ 4, 51]]], [28, [[ 4, 22], [ 4, 23]]], [24, [[ 3, 12], [ 8, 13]]]], |
|
182 | - 12 => [[24, [[ 2, 92], [ 2, 93]]], [22, [[ 6, 36], [ 2, 37]]], [26, [[ 4, 20], [ 6, 21]]], [28, [[ 7, 14], [ 4, 15]]]], |
|
183 | - 13 => [[26, [[ 4, 107], [ 0, 0]]], [22, [[ 8, 37], [ 1, 38]]], [24, [[ 8, 20], [ 4, 21]]], [22, [[12, 11], [ 4, 12]]]], |
|
184 | - 14 => [[30, [[ 3, 115], [ 1, 116]]], [24, [[ 4, 40], [ 5, 41]]], [20, [[11, 16], [ 5, 17]]], [24, [[11, 12], [ 5, 13]]]], |
|
185 | - 15 => [[22, [[ 5, 87], [ 1, 88]]], [24, [[ 5, 41], [ 5, 42]]], [30, [[ 5, 24], [ 7, 25]]], [24, [[11, 12], [ 7, 13]]]], |
|
186 | - 16 => [[24, [[ 5, 98], [ 1, 99]]], [28, [[ 7, 45], [ 3, 46]]], [24, [[15, 19], [ 2, 20]]], [30, [[ 3, 15], [13, 16]]]], |
|
187 | - 17 => [[28, [[ 1, 107], [ 5, 108]]], [28, [[10, 46], [ 1, 47]]], [28, [[ 1, 22], [15, 23]]], [28, [[ 2, 14], [17, 15]]]], |
|
188 | - 18 => [[30, [[ 5, 120], [ 1, 121]]], [26, [[ 9, 43], [ 4, 44]]], [28, [[17, 22], [ 1, 23]]], [28, [[ 2, 14], [19, 15]]]], |
|
189 | - 19 => [[28, [[ 3, 113], [ 4, 114]]], [26, [[ 3, 44], [11, 45]]], [26, [[17, 21], [ 4, 22]]], [26, [[ 9, 13], [16, 14]]]], |
|
190 | - 20 => [[28, [[ 3, 107], [ 5, 108]]], [26, [[ 3, 41], [13, 42]]], [30, [[15, 24], [ 5, 25]]], [28, [[15, 15], [10, 16]]]], |
|
191 | - 21 => [[28, [[ 4, 116], [ 4, 117]]], [26, [[17, 42], [ 0, 0]]], [28, [[17, 22], [ 6, 23]]], [30, [[19, 16], [ 6, 17]]]], |
|
192 | - 22 => [[28, [[ 2, 111], [ 7, 112]]], [28, [[17, 46], [ 0, 0]]], [30, [[ 7, 24], [16, 25]]], [24, [[34, 13], [ 0, 0]]]], |
|
193 | - 23 => [[30, [[ 4, 121], [ 5, 122]]], [28, [[ 4, 47], [14, 48]]], [30, [[11, 24], [14, 25]]], [30, [[16, 15], [14, 16]]]], |
|
194 | - 24 => [[30, [[ 6, 117], [ 4, 118]]], [28, [[ 6, 45], [14, 46]]], [30, [[11, 24], [16, 25]]], [30, [[30, 16], [ 2, 17]]]], |
|
195 | - 25 => [[26, [[ 8, 106], [ 4, 107]]], [28, [[ 8, 47], [13, 48]]], [30, [[ 7, 24], [22, 25]]], [30, [[22, 15], [13, 16]]]], |
|
196 | - 26 => [[28, [[10, 114], [ 2, 115]]], [28, [[19, 46], [ 4, 47]]], [28, [[28, 22], [ 6, 23]]], [30, [[33, 16], [ 4, 17]]]], |
|
197 | - 27 => [[30, [[ 8, 122], [ 4, 123]]], [28, [[22, 45], [ 3, 46]]], [30, [[ 8, 23], [26, 24]]], [30, [[12, 15], [28, 16]]]], |
|
198 | - 28 => [[30, [[ 3, 117], [10, 118]]], [28, [[ 3, 45], [23, 46]]], [30, [[ 4, 24], [31, 25]]], [30, [[11, 15], [31, 16]]]], |
|
199 | - 29 => [[30, [[ 7, 116], [ 7, 117]]], [28, [[21, 45], [ 7, 46]]], [30, [[ 1, 23], [37, 24]]], [30, [[19, 15], [26, 16]]]], |
|
200 | - 30 => [[30, [[ 5, 115], [10, 116]]], [28, [[19, 47], [10, 48]]], [30, [[15, 24], [25, 25]]], [30, [[23, 15], [25, 16]]]], |
|
201 | - 31 => [[30, [[13, 115], [ 3, 116]]], [28, [[ 2, 46], [29, 47]]], [30, [[42, 24], [ 1, 25]]], [30, [[23, 15], [28, 16]]]], |
|
202 | - 32 => [[30, [[17, 115], [ 0, 0]]], [28, [[10, 46], [23, 47]]], [30, [[10, 24], [35, 25]]], [30, [[19, 15], [35, 16]]]], |
|
203 | - 33 => [[30, [[17, 115], [ 1, 116]]], [28, [[14, 46], [21, 47]]], [30, [[29, 24], [19, 25]]], [30, [[11, 15], [46, 16]]]], |
|
204 | - 34 => [[30, [[13, 115], [ 6, 116]]], [28, [[14, 46], [23, 47]]], [30, [[44, 24], [ 7, 25]]], [30, [[59, 16], [ 1, 17]]]], |
|
205 | - 35 => [[30, [[12, 121], [ 7, 122]]], [28, [[12, 47], [26, 48]]], [30, [[39, 24], [14, 25]]], [30, [[22, 15], [41, 16]]]], |
|
206 | - 36 => [[30, [[ 6, 121], [14, 122]]], [28, [[ 6, 47], [34, 48]]], [30, [[46, 24], [10, 25]]], [30, [[ 2, 15], [64, 16]]]], |
|
207 | - 37 => [[30, [[17, 122], [ 4, 123]]], [28, [[29, 46], [14, 47]]], [30, [[49, 24], [10, 25]]], [30, [[24, 15], [46, 16]]]], |
|
208 | - 38 => [[30, [[ 4, 122], [18, 123]]], [28, [[13, 46], [32, 47]]], [30, [[48, 24], [14, 25]]], [30, [[42, 15], [32, 16]]]], |
|
209 | - 39 => [[30, [[20, 117], [ 4, 118]]], [28, [[40, 47], [ 7, 48]]], [30, [[43, 24], [22, 25]]], [30, [[10, 15], [67, 16]]]], |
|
210 | - 40 => [[30, [[19, 118], [ 6, 119]]], [28, [[18, 47], [31, 48]]], [30, [[34, 24], [34, 25]]], [30, [[20, 15], [61, 16]]]], |
|
171 | + 1 => [[7, [[1, 19], [0, 0]]], [10, [[1, 16], [0, 0]]], [13, [[1, 13], [0, 0]]], [17, [[1, 9], [0, 0]]]], |
|
172 | + 2 => [[10, [[1, 34], [0, 0]]], [16, [[1, 28], [0, 0]]], [22, [[1, 22], [0, 0]]], [28, [[1, 16], [0, 0]]]], |
|
173 | + 3 => [[15, [[1, 55], [0, 0]]], [26, [[1, 44], [0, 0]]], [18, [[2, 17], [0, 0]]], [22, [[2, 13], [0, 0]]]], |
|
174 | + 4 => [[20, [[1, 80], [0, 0]]], [18, [[2, 32], [0, 0]]], [26, [[2, 24], [0, 0]]], [16, [[4, 9], [0, 0]]]], |
|
175 | + 5 => [[26, [[1, 108], [0, 0]]], [24, [[2, 43], [0, 0]]], [18, [[2, 15], [2, 16]]], [22, [[2, 11], [2, 12]]]], |
|
176 | + 6 => [[18, [[2, 68], [0, 0]]], [16, [[4, 27], [0, 0]]], [24, [[4, 19], [0, 0]]], [28, [[4, 15], [0, 0]]]], |
|
177 | + 7 => [[20, [[2, 78], [0, 0]]], [18, [[4, 31], [0, 0]]], [18, [[2, 14], [4, 15]]], [26, [[4, 13], [1, 14]]]], |
|
178 | + 8 => [[24, [[2, 97], [0, 0]]], [22, [[2, 38], [2, 39]]], [22, [[4, 18], [2, 19]]], [26, [[4, 14], [2, 15]]]], |
|
179 | + 9 => [[30, [[2, 116], [0, 0]]], [22, [[3, 36], [2, 37]]], [20, [[4, 16], [4, 17]]], [24, [[4, 12], [4, 13]]]], |
|
180 | + 10 => [[18, [[2, 68], [2, 69]]], [26, [[4, 43], [1, 44]]], [24, [[6, 19], [2, 20]]], [28, [[6, 15], [2, 16]]]], |
|
181 | + 11 => [[20, [[4, 81], [0, 0]]], [30, [[1, 50], [4, 51]]], [28, [[4, 22], [4, 23]]], [24, [[3, 12], [8, 13]]]], |
|
182 | + 12 => [[24, [[2, 92], [2, 93]]], [22, [[6, 36], [2, 37]]], [26, [[4, 20], [6, 21]]], [28, [[7, 14], [4, 15]]]], |
|
183 | + 13 => [[26, [[4, 107], [0, 0]]], [22, [[8, 37], [1, 38]]], [24, [[8, 20], [4, 21]]], [22, [[12, 11], [4, 12]]]], |
|
184 | + 14 => [[30, [[3, 115], [1, 116]]], [24, [[4, 40], [5, 41]]], [20, [[11, 16], [5, 17]]], [24, [[11, 12], [5, 13]]]], |
|
185 | + 15 => [[22, [[5, 87], [1, 88]]], [24, [[5, 41], [5, 42]]], [30, [[5, 24], [7, 25]]], [24, [[11, 12], [7, 13]]]], |
|
186 | + 16 => [[24, [[5, 98], [1, 99]]], [28, [[7, 45], [3, 46]]], [24, [[15, 19], [2, 20]]], [30, [[3, 15], [13, 16]]]], |
|
187 | + 17 => [[28, [[1, 107], [5, 108]]], [28, [[10, 46], [1, 47]]], [28, [[1, 22], [15, 23]]], [28, [[2, 14], [17, 15]]]], |
|
188 | + 18 => [[30, [[5, 120], [1, 121]]], [26, [[9, 43], [4, 44]]], [28, [[17, 22], [1, 23]]], [28, [[2, 14], [19, 15]]]], |
|
189 | + 19 => [[28, [[3, 113], [4, 114]]], [26, [[3, 44], [11, 45]]], [26, [[17, 21], [4, 22]]], [26, [[9, 13], [16, 14]]]], |
|
190 | + 20 => [[28, [[3, 107], [5, 108]]], [26, [[3, 41], [13, 42]]], [30, [[15, 24], [5, 25]]], [28, [[15, 15], [10, 16]]]], |
|
191 | + 21 => [[28, [[4, 116], [4, 117]]], [26, [[17, 42], [0, 0]]], [28, [[17, 22], [6, 23]]], [30, [[19, 16], [6, 17]]]], |
|
192 | + 22 => [[28, [[2, 111], [7, 112]]], [28, [[17, 46], [0, 0]]], [30, [[7, 24], [16, 25]]], [24, [[34, 13], [0, 0]]]], |
|
193 | + 23 => [[30, [[4, 121], [5, 122]]], [28, [[4, 47], [14, 48]]], [30, [[11, 24], [14, 25]]], [30, [[16, 15], [14, 16]]]], |
|
194 | + 24 => [[30, [[6, 117], [4, 118]]], [28, [[6, 45], [14, 46]]], [30, [[11, 24], [16, 25]]], [30, [[30, 16], [2, 17]]]], |
|
195 | + 25 => [[26, [[8, 106], [4, 107]]], [28, [[8, 47], [13, 48]]], [30, [[7, 24], [22, 25]]], [30, [[22, 15], [13, 16]]]], |
|
196 | + 26 => [[28, [[10, 114], [2, 115]]], [28, [[19, 46], [4, 47]]], [28, [[28, 22], [6, 23]]], [30, [[33, 16], [4, 17]]]], |
|
197 | + 27 => [[30, [[8, 122], [4, 123]]], [28, [[22, 45], [3, 46]]], [30, [[8, 23], [26, 24]]], [30, [[12, 15], [28, 16]]]], |
|
198 | + 28 => [[30, [[3, 117], [10, 118]]], [28, [[3, 45], [23, 46]]], [30, [[4, 24], [31, 25]]], [30, [[11, 15], [31, 16]]]], |
|
199 | + 29 => [[30, [[7, 116], [7, 117]]], [28, [[21, 45], [7, 46]]], [30, [[1, 23], [37, 24]]], [30, [[19, 15], [26, 16]]]], |
|
200 | + 30 => [[30, [[5, 115], [10, 116]]], [28, [[19, 47], [10, 48]]], [30, [[15, 24], [25, 25]]], [30, [[23, 15], [25, 16]]]], |
|
201 | + 31 => [[30, [[13, 115], [3, 116]]], [28, [[2, 46], [29, 47]]], [30, [[42, 24], [1, 25]]], [30, [[23, 15], [28, 16]]]], |
|
202 | + 32 => [[30, [[17, 115], [0, 0]]], [28, [[10, 46], [23, 47]]], [30, [[10, 24], [35, 25]]], [30, [[19, 15], [35, 16]]]], |
|
203 | + 33 => [[30, [[17, 115], [1, 116]]], [28, [[14, 46], [21, 47]]], [30, [[29, 24], [19, 25]]], [30, [[11, 15], [46, 16]]]], |
|
204 | + 34 => [[30, [[13, 115], [6, 116]]], [28, [[14, 46], [23, 47]]], [30, [[44, 24], [7, 25]]], [30, [[59, 16], [1, 17]]]], |
|
205 | + 35 => [[30, [[12, 121], [7, 122]]], [28, [[12, 47], [26, 48]]], [30, [[39, 24], [14, 25]]], [30, [[22, 15], [41, 16]]]], |
|
206 | + 36 => [[30, [[6, 121], [14, 122]]], [28, [[6, 47], [34, 48]]], [30, [[46, 24], [10, 25]]], [30, [[2, 15], [64, 16]]]], |
|
207 | + 37 => [[30, [[17, 122], [4, 123]]], [28, [[29, 46], [14, 47]]], [30, [[49, 24], [10, 25]]], [30, [[24, 15], [46, 16]]]], |
|
208 | + 38 => [[30, [[4, 122], [18, 123]]], [28, [[13, 46], [32, 47]]], [30, [[48, 24], [14, 25]]], [30, [[42, 15], [32, 16]]]], |
|
209 | + 39 => [[30, [[20, 117], [4, 118]]], [28, [[40, 47], [7, 48]]], [30, [[43, 24], [22, 25]]], [30, [[10, 15], [67, 16]]]], |
|
210 | + 40 => [[30, [[19, 118], [6, 119]]], [28, [[18, 47], [31, 48]]], [30, [[34, 24], [34, 25]]], [30, [[20, 15], [61, 16]]]], |
|
211 | 211 | ]; |
212 | 212 | |
213 | 213 | private const TOTAL_CODEWORDS = [ |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | /** |
297 | 297 | * the version pattern for the given version |
298 | 298 | */ |
299 | - public function getVersionPattern():?int{ |
|
299 | + public function getVersionPattern(): ?int{ |
|
300 | 300 | return self::VERSION_PATTERN[$this->version] ?? null; |
301 | 301 | } |
302 | 302 | |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * |
315 | 315 | * @throws \chillerlan\QRCode\QRCodeException |
316 | 316 | */ |
317 | - public function getMaxLengthForMode(int $mode, EccLevel $eccLevel):?int{ |
|
317 | + public function getMaxLengthForMode(int $mode, EccLevel $eccLevel): ?int{ |
|
318 | 318 | |
319 | 319 | $dataModes = [ |
320 | 320 | Mode::NUMBER => 0, |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | [$numEccCodewords, $eccBlocks] = $version->getRSBlocks($eccLevel); |
128 | 128 | |
129 | 129 | // Now establish DataBlocks of the appropriate size and number of data codewords |
130 | - $result = [];//new DataBlock[$totalBlocks]; |
|
130 | + $result = []; //new DataBlock[$totalBlocks]; |
|
131 | 131 | $numResultBlocks = 0; |
132 | 132 | |
133 | 133 | foreach($eccBlocks as $blockData){ |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $codewordsInts = []; |
196 | 196 | |
197 | 197 | foreach($codewordBytes as $i => $codewordByte){ |
198 | - $codewordsInts[$i] = $codewordByte & 0xFF; |
|
198 | + $codewordsInts[$i] = $codewordByte&0xFF; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | $decoded = (new ReedSolomonDecoder)->decode($codewordsInts, (count($codewordBytes) - $numDataCodewords)); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $offset = (int)($y * $this->rowSize + ($x / 0x20)); |
48 | 48 | |
49 | 49 | $this->bits[$offset] ??= 0; |
50 | - $this->bits[$offset] |= ($this->bits[$offset] |= 1 << ($x & 0x1f)); |
|
50 | + $this->bits[$offset] |= ($this->bits[$offset] |= 1 << ($x&0x1f)); |
|
51 | 51 | |
52 | 52 | return $this; |
53 | 53 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | public function flip(int $x, int $y):self{ |
62 | 62 | $offset = $y * $this->rowSize + (int)($x / 0x20); |
63 | 63 | |
64 | - $this->bits[$offset] = ($this->bits[$offset] ^ (1 << ($x & 0x1f))); |
|
64 | + $this->bits[$offset] = ($this->bits[$offset]^(1 << ($x&0x1f))); |
|
65 | 65 | |
66 | 66 | return $this; |
67 | 67 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | for($x = $left; $x < $right; $x++){ |
100 | 100 | $xOffset = $yOffset + (int)($x / 0x20); |
101 | - $this->bits[$xOffset] = ($this->bits[$xOffset] |= 1 << ($x & 0x1f)); |
|
101 | + $this->bits[$xOffset] = ($this->bits[$xOffset] |= 1 << ($x&0x1f)); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | /** |
116 | 116 | * |
117 | 117 | */ |
118 | - public function getFormatInfo():?FormatInformation{ |
|
118 | + public function getFormatInfo(): ?FormatInformation{ |
|
119 | 119 | return $this->formatInfo; |
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
123 | 123 | * |
124 | 124 | */ |
125 | - public function getVersion():?Version{ |
|
125 | + public function getVersion(): ?Version{ |
|
126 | 126 | return $this->version; |
127 | 127 | } |
128 | 128 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | $this->bits[$offset] ??= 0; |
141 | 141 | |
142 | - return ($this->uRShift($this->bits[$offset], ($x & 0x1f)) & 1) !== 0; |
|
142 | + return ($this->uRShift($this->bits[$offset], ($x&0x1f))&1) !== 0; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | ? $this->get($j, $i) |
248 | 248 | : $this->get($i, $j); |
249 | 249 | |
250 | - return $bit ? ($versionBits << 1) | 0x1 : $versionBits << 1; |
|
250 | + return $bit ? ($versionBits << 1)|0x1 : $versionBits << 1; |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -364,8 +364,8 @@ discard block |
||
364 | 364 | // Should return null, but, some QR codes apparently do not mask this info. |
365 | 365 | // Try again by actually masking the pattern first. |
366 | 366 | $this->formatInfo = $this->doDecodeFormatInformation( |
367 | - $formatInfoBits1 ^ FormatInformation::FORMAT_INFO_MASK_QR, |
|
368 | - $formatInfoBits2 ^ FormatInformation::FORMAT_INFO_MASK_QR |
|
367 | + $formatInfoBits1^FormatInformation::FORMAT_INFO_MASK_QR, |
|
368 | + $formatInfoBits2^FormatInformation::FORMAT_INFO_MASK_QR |
|
369 | 369 | ); |
370 | 370 | |
371 | 371 | if($this->formatInfo !== null){ |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | * @return \chillerlan\QRCode\Common\FormatInformation|null information about the format it specifies, or null |
384 | 384 | * if doesn't seem to match any known pattern |
385 | 385 | */ |
386 | - private function doDecodeFormatInformation(int $maskedFormatInfo1, int $maskedFormatInfo2):?FormatInformation{ |
|
386 | + private function doDecodeFormatInformation(int $maskedFormatInfo1, int $maskedFormatInfo2): ?FormatInformation{ |
|
387 | 387 | // Find the int in FORMAT_INFO_DECODE_LOOKUP with fewest bits differing |
388 | 388 | $bestDifference = PHP_INT_MAX; |
389 | 389 | $bestFormatInfo = 0; |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | * |
480 | 480 | * @return \chillerlan\QRCode\Common\Version|null |
481 | 481 | */ |
482 | - private function decodeVersionInformation(int $versionBits):?Version{ |
|
482 | + private function decodeVersionInformation(int $versionBits): ?Version{ |
|
483 | 483 | $bestDifference = PHP_INT_MAX; |
484 | 484 | $bestVersion = 0; |
485 | 485 | |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | return $a; |
522 | 522 | } |
523 | 523 | |
524 | - return ($a >> $b) & ~((1 << (8 * PHP_INT_SIZE - 1)) >> ($b - 1)); |
|
524 | + return ($a >> $b)&~((1 << (8 * PHP_INT_SIZE - 1)) >> ($b - 1)); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | /** |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | $count = 0; |
537 | 537 | |
538 | 538 | for($i = 0; $i < 32; $i += 4){ |
539 | - $count += $BITS_SET_IN_HALF_BYTE[$this->uRShift($a, $i) & 0x0F]; |
|
539 | + $count += $BITS_SET_IN_HALF_BYTE[$this->uRShift($a, $i)&0x0F]; |
|
540 | 540 | } |
541 | 541 | |
542 | 542 | return $count; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $matrix[$y] = []; |
130 | 130 | |
131 | 131 | foreach($row as $x => $val){ |
132 | - $matrix[$y][$x] = ($val & $this::IS_DARK) === $this::IS_DARK; |
|
132 | + $matrix[$y][$x] = ($val&$this::IS_DARK) === $this::IS_DARK; |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | /** |
154 | 154 | * Returns the current mask pattern |
155 | 155 | */ |
156 | - public function maskPattern():?MaskPattern{ |
|
156 | + public function maskPattern(): ?MaskPattern{ |
|
157 | 157 | return $this->maskPattern; |
158 | 158 | } |
159 | 159 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * false => $M_TYPE |
181 | 181 | */ |
182 | 182 | public function set(int $x, int $y, bool $value, int $M_TYPE):self{ |
183 | - $this->matrix[$y][$x] = $M_TYPE | ($value ? $this::IS_DARK : 0); |
|
183 | + $this->matrix[$y][$x] = $M_TYPE|($value ? $this::IS_DARK : 0); |
|
184 | 184 | |
185 | 185 | return $this; |
186 | 186 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * true => $value & $M_TYPE === $M_TYPE |
201 | 201 | */ |
202 | 202 | public function checkType(int $x, int $y, int $M_TYPE):bool{ |
203 | - return ($this->matrix[$y][$x] & $M_TYPE) === $M_TYPE; |
|
203 | + return ($this->matrix[$y][$x]&$M_TYPE) === $M_TYPE; |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -280,8 +280,8 @@ discard block |
||
280 | 280 | |
281 | 281 | for($c = 0; $c < 3; $c++){ |
282 | 282 | for($i = 0; $i < 8; $i++){ |
283 | - $this->set($h[$c][0] , $h[$c][1] + $i, false, $this::M_SEPARATOR); |
|
284 | - $this->set($v[$c][0] - $i, $v[$c][1] , false, $this::M_SEPARATOR); |
|
283 | + $this->set($h[$c][0], $h[$c][1] + $i, false, $this::M_SEPARATOR); |
|
284 | + $this->set($v[$c][0] - $i, $v[$c][1], false, $this::M_SEPARATOR); |
|
285 | 285 | } |
286 | 286 | } |
287 | 287 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | for($i = 0; $i < 18; $i++){ |
356 | 356 | $a = (int)($i / 3); |
357 | 357 | $b = $i % 3 + $this->moduleCount - 8 - 3; |
358 | - $v = (($bits >> $i) & 1) === 1; |
|
358 | + $v = (($bits >> $i)&1) === 1; |
|
359 | 359 | |
360 | 360 | $this->set($b, $a, $v, $this::M_VERSION); // ne |
361 | 361 | $this->set($a, $b, $v, $this::M_VERSION); // sw |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | $bits = $this->eccLevel->getformatPattern($maskPattern); |
376 | 376 | |
377 | 377 | for($i = 0; $i < 15; $i++){ |
378 | - $v = (($bits >> $i) & 1) === 1; |
|
378 | + $v = (($bits >> $i)&1) === 1; |
|
379 | 379 | |
380 | 380 | if($i < 6){ |
381 | 381 | $this->set(8, $i, $v, $this::M_FORMAT); |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | foreach($this->matrix as $y => $row){ |
496 | 496 | foreach($row as $x => $val){ |
497 | 497 | // out of bounds, skip |
498 | - if($x < $start || $y < $start ||$x >= $end || $y >= $end){ |
|
498 | + if($x < $start || $y < $start || $x >= $end || $y >= $end){ |
|
499 | 499 | continue; |
500 | 500 | } |
501 | 501 | // a match |
@@ -542,10 +542,10 @@ discard block |
||
542 | 542 | $v = false; |
543 | 543 | |
544 | 544 | if($byteIndex < $byteCount){ |
545 | - $v = (($data[$byteIndex] >> $bitIndex) & 1) === 1; |
|
545 | + $v = (($data[$byteIndex] >> $bitIndex)&1) === 1; |
|
546 | 546 | } |
547 | 547 | |
548 | - $this->matrix[$y][$x] = $this::M_DATA | ($v ? $this::IS_DARK : 0); |
|
548 | + $this->matrix[$y][$x] = $this::M_DATA|($v ? $this::IS_DARK : 0); |
|
549 | 549 | $bitIndex--; |
550 | 550 | |
551 | 551 | if($bitIndex === -1){ |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | $y += $inc; |
559 | 559 | |
560 | 560 | if($y < 0 || $this->moduleCount <= $y){ |
561 | - $y -= $inc; |
|
561 | + $y -= $inc; |
|
562 | 562 | $inc = -$inc; |
563 | 563 | |
564 | 564 | break; |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | |
582 | 582 | foreach($this->matrix as $y => &$row){ |
583 | 583 | foreach($row as $x => &$val){ |
584 | - if($mask($x, $y) && ($val & $this::M_DATA) === $this::M_DATA){ |
|
584 | + if($mask($x, $y) && ($val&$this::M_DATA) === $this::M_DATA){ |
|
585 | 585 | $val ^= $this::IS_DARK; |
586 | 586 | } |
587 | 587 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function __construct(int $maskPattern){ |
60 | 60 | |
61 | - if((0b111 & $maskPattern) !== $maskPattern){ |
|
61 | + if((0b111&$maskPattern) !== $maskPattern){ |
|
62 | 62 | throw new QRCodeException('invalid mask pattern'); |
63 | 63 | } |
64 | 64 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $penalty += 3 + ($numSameBitCells - 5); |
150 | 150 | } |
151 | 151 | |
152 | - $numSameBitCells = 1; // Include the cell itself. |
|
152 | + $numSameBitCells = 1; // Include the cell itself. |
|
153 | 153 | $prevBit = $bit; |
154 | 154 | } |
155 | 155 | } |
@@ -152,7 +152,8 @@ |
||
152 | 152 | } |
153 | 153 | } |
154 | 154 | } |
155 | - catch(Throwable $aioobe){//ArrayIndexOutOfBoundsException |
|
155 | + catch(Throwable $aioobe){ |
|
156 | +//ArrayIndexOutOfBoundsException |
|
156 | 157 | // This feels wrong, but, sometimes if the finder patterns are misidentified, the resulting |
157 | 158 | // transform gets "twisted" such that it maps a straight line of points to a set of points |
158 | 159 | // whose endpoints are in bounds, but others are not. There is probably some mathematical |
@@ -59,7 +59,7 @@ |
||
59 | 59 | $count = count($pixels); |
60 | 60 | |
61 | 61 | for($i = 0; $i < $count; $i += 3){ |
62 | - $this->setLuminancePixel($pixels[$i] & 0xff, $pixels[$i + 1] & 0xff, $pixels[$i + 2] & 0xff); |
|
62 | + $this->setLuminancePixel($pixels[$i]&0xff, $pixels[$i + 1]&0xff, $pixels[$i + 2]&0xff); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 |