@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | [$numEccCodewords, $eccBlocks] = $this->version->getRSBlocks($this->eccLevel); |
79 | 79 | |
80 | 80 | // Now establish DataBlocks of the appropriate size and number of data codewords |
81 | - $result = [];//new DataBlock[$totalBlocks]; |
|
81 | + $result = []; //new DataBlock[$totalBlocks]; |
|
82 | 82 | $numResultBlocks = 0; |
83 | 83 | |
84 | 84 | foreach($eccBlocks as $blockData){ |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | // Above should work but fails on some Apple and Linux JDKs due to a Hotspot bug. |
305 | 305 | // Below is a funny-looking workaround from Steven Parkes |
306 | 306 | $term = GF256::multiply($errorLocations[$j], $xiInverse); |
307 | - $denominator = GF256::multiply($denominator, ((($term & 0x1) === 0) ? ($term | 1) : ($term & ~1))); |
|
307 | + $denominator = GF256::multiply($denominator, ((($term & 0x1) === 0) ? ($term|1) : ($term & ~1))); |
|
308 | 308 | } |
309 | 309 | } |
310 | 310 |
@@ -36,41 +36,41 @@ discard block |
||
36 | 36 | |
37 | 37 | private const logTable = [ |
38 | 38 | 0, // the first value is never returned, index starts at 1 |
39 | - 0, 1, 25, 2, 50, 26, 198, 3, 223, 51, 238, 27, 104, 199, 75, |
|
40 | - 4, 100, 224, 14, 52, 141, 239, 129, 28, 193, 105, 248, 200, 8, 76, 113, |
|
41 | - 5, 138, 101, 47, 225, 36, 15, 33, 53, 147, 142, 218, 240, 18, 130, 69, |
|
42 | - 29, 181, 194, 125, 106, 39, 249, 185, 201, 154, 9, 120, 77, 228, 114, 166, |
|
43 | - 6, 191, 139, 98, 102, 221, 48, 253, 226, 152, 37, 179, 16, 145, 34, 136, |
|
44 | - 54, 208, 148, 206, 143, 150, 219, 189, 241, 210, 19, 92, 131, 56, 70, 64, |
|
45 | - 30, 66, 182, 163, 195, 72, 126, 110, 107, 58, 40, 84, 250, 133, 186, 61, |
|
46 | - 202, 94, 155, 159, 10, 21, 121, 43, 78, 212, 229, 172, 115, 243, 167, 87, |
|
47 | - 7, 112, 192, 247, 140, 128, 99, 13, 103, 74, 222, 237, 49, 197, 254, 24, |
|
48 | - 227, 165, 153, 119, 38, 184, 180, 124, 17, 68, 146, 217, 35, 32, 137, 46, |
|
49 | - 55, 63, 209, 91, 149, 188, 207, 205, 144, 135, 151, 178, 220, 252, 190, 97, |
|
50 | - 242, 86, 211, 171, 20, 42, 93, 158, 132, 60, 57, 83, 71, 109, 65, 162, |
|
51 | - 31, 45, 67, 216, 183, 123, 164, 118, 196, 23, 73, 236, 127, 12, 111, 246, |
|
52 | - 108, 161, 59, 82, 41, 157, 85, 170, 251, 96, 134, 177, 187, 204, 62, 90, |
|
53 | - 203, 89, 95, 176, 156, 169, 160, 81, 11, 245, 22, 235, 122, 117, 44, 215, |
|
54 | - 79, 174, 213, 233, 230, 231, 173, 232, 116, 214, 244, 234, 168, 80, 88, 175, |
|
39 | + 0, 1, 25, 2, 50, 26, 198, 3, 223, 51, 238, 27, 104, 199, 75, |
|
40 | + 4, 100, 224, 14, 52, 141, 239, 129, 28, 193, 105, 248, 200, 8, 76, 113, |
|
41 | + 5, 138, 101, 47, 225, 36, 15, 33, 53, 147, 142, 218, 240, 18, 130, 69, |
|
42 | + 29, 181, 194, 125, 106, 39, 249, 185, 201, 154, 9, 120, 77, 228, 114, 166, |
|
43 | + 6, 191, 139, 98, 102, 221, 48, 253, 226, 152, 37, 179, 16, 145, 34, 136, |
|
44 | + 54, 208, 148, 206, 143, 150, 219, 189, 241, 210, 19, 92, 131, 56, 70, 64, |
|
45 | + 30, 66, 182, 163, 195, 72, 126, 110, 107, 58, 40, 84, 250, 133, 186, 61, |
|
46 | + 202, 94, 155, 159, 10, 21, 121, 43, 78, 212, 229, 172, 115, 243, 167, 87, |
|
47 | + 7, 112, 192, 247, 140, 128, 99, 13, 103, 74, 222, 237, 49, 197, 254, 24, |
|
48 | + 227, 165, 153, 119, 38, 184, 180, 124, 17, 68, 146, 217, 35, 32, 137, 46, |
|
49 | + 55, 63, 209, 91, 149, 188, 207, 205, 144, 135, 151, 178, 220, 252, 190, 97, |
|
50 | + 242, 86, 211, 171, 20, 42, 93, 158, 132, 60, 57, 83, 71, 109, 65, 162, |
|
51 | + 31, 45, 67, 216, 183, 123, 164, 118, 196, 23, 73, 236, 127, 12, 111, 246, |
|
52 | + 108, 161, 59, 82, 41, 157, 85, 170, 251, 96, 134, 177, 187, 204, 62, 90, |
|
53 | + 203, 89, 95, 176, 156, 169, 160, 81, 11, 245, 22, 235, 122, 117, 44, 215, |
|
54 | + 79, 174, 213, 233, 230, 231, 173, 232, 116, 214, 244, 234, 168, 80, 88, 175, |
|
55 | 55 | ]; |
56 | 56 | |
57 | 57 | private const expTable = [ |
58 | - 1, 2, 4, 8, 16, 32, 64, 128, 29, 58, 116, 232, 205, 135, 19, 38, |
|
59 | - 76, 152, 45, 90, 180, 117, 234, 201, 143, 3, 6, 12, 24, 48, 96, 192, |
|
60 | - 157, 39, 78, 156, 37, 74, 148, 53, 106, 212, 181, 119, 238, 193, 159, 35, |
|
61 | - 70, 140, 5, 10, 20, 40, 80, 160, 93, 186, 105, 210, 185, 111, 222, 161, |
|
62 | - 95, 190, 97, 194, 153, 47, 94, 188, 101, 202, 137, 15, 30, 60, 120, 240, |
|
63 | - 253, 231, 211, 187, 107, 214, 177, 127, 254, 225, 223, 163, 91, 182, 113, 226, |
|
64 | - 217, 175, 67, 134, 17, 34, 68, 136, 13, 26, 52, 104, 208, 189, 103, 206, |
|
65 | - 129, 31, 62, 124, 248, 237, 199, 147, 59, 118, 236, 197, 151, 51, 102, 204, |
|
66 | - 133, 23, 46, 92, 184, 109, 218, 169, 79, 158, 33, 66, 132, 21, 42, 84, |
|
67 | - 168, 77, 154, 41, 82, 164, 85, 170, 73, 146, 57, 114, 228, 213, 183, 115, |
|
68 | - 230, 209, 191, 99, 198, 145, 63, 126, 252, 229, 215, 179, 123, 246, 241, 255, |
|
69 | - 227, 219, 171, 75, 150, 49, 98, 196, 149, 55, 110, 220, 165, 87, 174, 65, |
|
70 | - 130, 25, 50, 100, 200, 141, 7, 14, 28, 56, 112, 224, 221, 167, 83, 166, |
|
71 | - 81, 162, 89, 178, 121, 242, 249, 239, 195, 155, 43, 86, 172, 69, 138, 9, |
|
72 | - 18, 36, 72, 144, 61, 122, 244, 245, 247, 243, 251, 235, 203, 139, 11, 22, |
|
73 | - 44, 88, 176, 125, 250, 233, 207, 131, 27, 54, 108, 216, 173, 71, 142, 1, |
|
58 | + 1, 2, 4, 8, 16, 32, 64, 128, 29, 58, 116, 232, 205, 135, 19, 38, |
|
59 | + 76, 152, 45, 90, 180, 117, 234, 201, 143, 3, 6, 12, 24, 48, 96, 192, |
|
60 | + 157, 39, 78, 156, 37, 74, 148, 53, 106, 212, 181, 119, 238, 193, 159, 35, |
|
61 | + 70, 140, 5, 10, 20, 40, 80, 160, 93, 186, 105, 210, 185, 111, 222, 161, |
|
62 | + 95, 190, 97, 194, 153, 47, 94, 188, 101, 202, 137, 15, 30, 60, 120, 240, |
|
63 | + 253, 231, 211, 187, 107, 214, 177, 127, 254, 225, 223, 163, 91, 182, 113, 226, |
|
64 | + 217, 175, 67, 134, 17, 34, 68, 136, 13, 26, 52, 104, 208, 189, 103, 206, |
|
65 | + 129, 31, 62, 124, 248, 237, 199, 147, 59, 118, 236, 197, 151, 51, 102, 204, |
|
66 | + 133, 23, 46, 92, 184, 109, 218, 169, 79, 158, 33, 66, 132, 21, 42, 84, |
|
67 | + 168, 77, 154, 41, 82, 164, 85, 170, 73, 146, 57, 114, 228, 213, 183, 115, |
|
68 | + 230, 209, 191, 99, 198, 145, 63, 126, 252, 229, 215, 179, 123, 246, 241, 255, |
|
69 | + 227, 219, 171, 75, 150, 49, 98, 196, 149, 55, 110, 220, 165, 87, 174, 65, |
|
70 | + 130, 25, 50, 100, 200, 141, 7, 14, 28, 56, 112, 224, 221, 167, 83, 166, |
|
71 | + 81, 162, 89, 178, 121, 242, 249, 239, 195, 155, 43, 86, 172, 69, 138, 9, |
|
72 | + 18, 36, 72, 144, 61, 122, 244, 245, 247, 243, 251, 235, 203, 139, 11, 22, |
|
73 | + 44, 88, 176, 125, 250, 233, 207, 131, 27, 54, 108, 216, 173, 71, 142, 1, |
|
74 | 74 | ]; |
75 | 75 | |
76 | 76 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @return int sum/difference of a and b |
80 | 80 | */ |
81 | 81 | public static function addOrSubtract(int $a, int $b):int{ |
82 | - return ($a ^ $b); |
|
82 | + return ($a^$b); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function __construct(int $maskPattern){ |
69 | 69 | |
70 | - if((0b111 & $maskPattern) !== $maskPattern){ |
|
70 | + if((0b111&$maskPattern) !== $maskPattern){ |
|
71 | 71 | throw new QRCodeException('invalid mask pattern'); |
72 | 72 | } |
73 | 73 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $penalty += (3 + ($numSameBitCells - 5)); |
162 | 162 | } |
163 | 163 | |
164 | - $numSameBitCells = 1; // Include the cell itself. |
|
164 | + $numSameBitCells = 1; // Include the cell itself. |
|
165 | 165 | $prevBit = $bit; |
166 | 166 | } |
167 | 167 | } |
@@ -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 | } |
@@ -75,15 +75,15 @@ |
||
75 | 75 | QRMatrix::M_LOGO => false, |
76 | 76 | QRMatrix::M_TEST => false, |
77 | 77 | // dark |
78 | - (QRMatrix::M_DARKMODULE | QRMatrix::IS_DARK) => true, |
|
79 | - (QRMatrix::M_DATA | QRMatrix::IS_DARK) => true, |
|
80 | - (QRMatrix::M_FINDER | QRMatrix::IS_DARK) => true, |
|
81 | - (QRMatrix::M_ALIGNMENT | QRMatrix::IS_DARK) => true, |
|
82 | - (QRMatrix::M_TIMING | QRMatrix::IS_DARK) => true, |
|
83 | - (QRMatrix::M_FORMAT | QRMatrix::IS_DARK) => true, |
|
84 | - (QRMatrix::M_VERSION | QRMatrix::IS_DARK) => true, |
|
85 | - (QRMatrix::M_FINDER_DOT | QRMatrix::IS_DARK) => true, |
|
86 | - (QRMatrix::M_TEST | QRMatrix::IS_DARK) => true, |
|
78 | + (QRMatrix::M_DARKMODULE|QRMatrix::IS_DARK) => true, |
|
79 | + (QRMatrix::M_DATA|QRMatrix::IS_DARK) => true, |
|
80 | + (QRMatrix::M_FINDER|QRMatrix::IS_DARK) => true, |
|
81 | + (QRMatrix::M_ALIGNMENT|QRMatrix::IS_DARK) => true, |
|
82 | + (QRMatrix::M_TIMING|QRMatrix::IS_DARK) => true, |
|
83 | + (QRMatrix::M_FORMAT|QRMatrix::IS_DARK) => true, |
|
84 | + (QRMatrix::M_VERSION|QRMatrix::IS_DARK) => true, |
|
85 | + (QRMatrix::M_FINDER_DOT|QRMatrix::IS_DARK) => true, |
|
86 | + (QRMatrix::M_TEST|QRMatrix::IS_DARK) => true, |
|
87 | 87 | ]; |
88 | 88 | |
89 | 89 | /** |
@@ -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); |
@@ -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 = []; |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * |
174 | 174 | * @return \chillerlan\QRCode\Detector\AlignmentPattern|null if we have found the same pattern twice, or null if not |
175 | 175 | */ |
176 | - private function handlePossibleCenter(array $stateCount, int $i, int $j):?AlignmentPattern{ |
|
176 | + private function handlePossibleCenter(array $stateCount, int $i, int $j): ?AlignmentPattern{ |
|
177 | 177 | $stateCountTotal = ($stateCount[0] + $stateCount[1] + $stateCount[2]); |
178 | 178 | $centerJ = $this->centerFromEnd($stateCount, $j); |
179 | 179 | $centerI = $this->crossCheckVertical($i, (int)$centerJ, (2 * $stateCount[1]), $stateCountTotal); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * |
223 | 223 | * @return float|null vertical center of alignment pattern, or null if not found |
224 | 224 | */ |
225 | - private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal):?float{ |
|
225 | + private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal): ?float{ |
|
226 | 226 | $maxI = $this->matrix->size(); |
227 | 227 | $stateCount = []; |
228 | 228 | $stateCount[0] = 0; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $byte2 = ord($string[($i + 1)]); |
100 | 100 | |
101 | 101 | // byte 1 unused and vendor ranges |
102 | - if($byte1 < 0x81 || ($byte1 > 0x84 && $byte1 < 0x88) || ($byte1 > 0x9f && $byte1 < 0xe0) || $byte1 > 0xea){ |
|
102 | + if($byte1 < 0x81 || ($byte1 > 0x84 && $byte1 < 0x88) || ($byte1 > 0x9f && $byte1 < 0xe0) || $byte1 > 0xea){ |
|
103 | 103 | return false; |
104 | 104 | } |
105 | 105 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $len = strlen($this->data); |
129 | 129 | |
130 | 130 | for($i = 0; ($i + 1) < $len; $i += 2){ |
131 | - $c = (((0xff & ord($this->data[$i])) << 8) | (0xff & ord($this->data[($i + 1)]))); |
|
131 | + $c = (((0xff & ord($this->data[$i])) << 8)|(0xff & ord($this->data[($i + 1)]))); |
|
132 | 132 | |
133 | 133 | if($c >= 0x8140 && $c <= 0x9ffc){ |
134 | 134 | $c -= 0x8140; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $length = $bitBuffer->read(self::getLengthBits($versionNumber)); |
159 | 159 | |
160 | 160 | if($bitBuffer->available() < ($length * 13)){ |
161 | - throw new QRCodeDataException('not enough bits available'); // @codeCoverageIgnore |
|
161 | + throw new QRCodeDataException('not enough bits available'); // @codeCoverageIgnore |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | // Each character will require 2 bytes. Read the characters as 2-byte pairs and decode as SJIS afterwards |
@@ -168,15 +168,15 @@ discard block |
||
168 | 168 | while($length > 0){ |
169 | 169 | // Each 13 bits encodes a 2-byte character |
170 | 170 | $twoBytes = $bitBuffer->read(13); |
171 | - $assembledTwoBytes = ((((int)($twoBytes / 0x0c0)) << 8) | ($twoBytes % 0x0c0)); |
|
171 | + $assembledTwoBytes = ((((int)($twoBytes / 0x0c0)) << 8)|($twoBytes % 0x0c0)); |
|
172 | 172 | |
173 | 173 | $assembledTwoBytes += ($assembledTwoBytes < 0x01f00) |
174 | 174 | ? 0x08140 // In the 0x8140 to 0x9FFC range |
175 | 175 | : 0x0c140; // In the 0xE040 to 0xEBBF range |
176 | 176 | |
177 | 177 | $buffer[$offset] = chr(0xff & ($assembledTwoBytes >> 8)); |
178 | - $buffer[($offset + 1)] = chr(0xff & $assembledTwoBytes); |
|
179 | - $offset += 2; |
|
178 | + $buffer[($offset + 1)] = chr(0xff&$assembledTwoBytes); |
|
179 | + $offset += 2; |
|
180 | 180 | $length--; |
181 | 181 | } |
182 | 182 |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $len = strlen($this->data); |
132 | 132 | |
133 | 133 | for($i = 0; ($i + 1) < $len; $i += 2){ |
134 | - $c = (((0xff & ord($this->data[$i])) << 8) | (0xff & ord($this->data[($i + 1)]))); |
|
134 | + $c = (((0xff & ord($this->data[$i])) << 8)|(0xff & ord($this->data[($i + 1)]))); |
|
135 | 135 | |
136 | 136 | if($c >= 0xa1a1 && $c <= 0xaafe){ |
137 | 137 | $c -= 0x0a1a1; |
@@ -177,15 +177,15 @@ discard block |
||
177 | 177 | while($length > 0){ |
178 | 178 | // Each 13 bits encodes a 2-byte character |
179 | 179 | $twoBytes = $bitBuffer->read(13); |
180 | - $assembledTwoBytes = ((((int)($twoBytes / 0x060)) << 8) | ($twoBytes % 0x060)); |
|
180 | + $assembledTwoBytes = ((((int)($twoBytes / 0x060)) << 8)|($twoBytes % 0x060)); |
|
181 | 181 | |
182 | 182 | $assembledTwoBytes += ($assembledTwoBytes < 0x00a00) // 0x003BF |
183 | 183 | ? 0x0a1a1 // In the 0xA1A1 to 0xAAFE range |
184 | 184 | : 0x0a6a1; // In the 0xB0A1 to 0xFAFE range |
185 | 185 | |
186 | 186 | $buffer[$offset] = chr(0xff & ($assembledTwoBytes >> 8)); |
187 | - $buffer[($offset + 1)] = chr(0xff & $assembledTwoBytes); |
|
188 | - $offset += 2; |
|
187 | + $buffer[($offset + 1)] = chr(0xff&$assembledTwoBytes); |
|
188 | + $offset += 2; |
|
189 | 189 | $length--; |
190 | 190 | } |
191 | 191 |