@@ -38,41 +38,41 @@ discard block |
||
38 | 38 | |
39 | 39 | private const logTable = [ |
40 | 40 | 0, // the first value is never returned, index starts at 1 |
41 | - 0, 1, 25, 2, 50, 26, 198, 3, 223, 51, 238, 27, 104, 199, 75, |
|
42 | - 4, 100, 224, 14, 52, 141, 239, 129, 28, 193, 105, 248, 200, 8, 76, 113, |
|
43 | - 5, 138, 101, 47, 225, 36, 15, 33, 53, 147, 142, 218, 240, 18, 130, 69, |
|
44 | - 29, 181, 194, 125, 106, 39, 249, 185, 201, 154, 9, 120, 77, 228, 114, 166, |
|
45 | - 6, 191, 139, 98, 102, 221, 48, 253, 226, 152, 37, 179, 16, 145, 34, 136, |
|
46 | - 54, 208, 148, 206, 143, 150, 219, 189, 241, 210, 19, 92, 131, 56, 70, 64, |
|
47 | - 30, 66, 182, 163, 195, 72, 126, 110, 107, 58, 40, 84, 250, 133, 186, 61, |
|
48 | - 202, 94, 155, 159, 10, 21, 121, 43, 78, 212, 229, 172, 115, 243, 167, 87, |
|
49 | - 7, 112, 192, 247, 140, 128, 99, 13, 103, 74, 222, 237, 49, 197, 254, 24, |
|
50 | - 227, 165, 153, 119, 38, 184, 180, 124, 17, 68, 146, 217, 35, 32, 137, 46, |
|
51 | - 55, 63, 209, 91, 149, 188, 207, 205, 144, 135, 151, 178, 220, 252, 190, 97, |
|
52 | - 242, 86, 211, 171, 20, 42, 93, 158, 132, 60, 57, 83, 71, 109, 65, 162, |
|
53 | - 31, 45, 67, 216, 183, 123, 164, 118, 196, 23, 73, 236, 127, 12, 111, 246, |
|
54 | - 108, 161, 59, 82, 41, 157, 85, 170, 251, 96, 134, 177, 187, 204, 62, 90, |
|
55 | - 203, 89, 95, 176, 156, 169, 160, 81, 11, 245, 22, 235, 122, 117, 44, 215, |
|
56 | - 79, 174, 213, 233, 230, 231, 173, 232, 116, 214, 244, 234, 168, 80, 88, 175, |
|
41 | + 0, 1, 25, 2, 50, 26, 198, 3, 223, 51, 238, 27, 104, 199, 75, |
|
42 | + 4, 100, 224, 14, 52, 141, 239, 129, 28, 193, 105, 248, 200, 8, 76, 113, |
|
43 | + 5, 138, 101, 47, 225, 36, 15, 33, 53, 147, 142, 218, 240, 18, 130, 69, |
|
44 | + 29, 181, 194, 125, 106, 39, 249, 185, 201, 154, 9, 120, 77, 228, 114, 166, |
|
45 | + 6, 191, 139, 98, 102, 221, 48, 253, 226, 152, 37, 179, 16, 145, 34, 136, |
|
46 | + 54, 208, 148, 206, 143, 150, 219, 189, 241, 210, 19, 92, 131, 56, 70, 64, |
|
47 | + 30, 66, 182, 163, 195, 72, 126, 110, 107, 58, 40, 84, 250, 133, 186, 61, |
|
48 | + 202, 94, 155, 159, 10, 21, 121, 43, 78, 212, 229, 172, 115, 243, 167, 87, |
|
49 | + 7, 112, 192, 247, 140, 128, 99, 13, 103, 74, 222, 237, 49, 197, 254, 24, |
|
50 | + 227, 165, 153, 119, 38, 184, 180, 124, 17, 68, 146, 217, 35, 32, 137, 46, |
|
51 | + 55, 63, 209, 91, 149, 188, 207, 205, 144, 135, 151, 178, 220, 252, 190, 97, |
|
52 | + 242, 86, 211, 171, 20, 42, 93, 158, 132, 60, 57, 83, 71, 109, 65, 162, |
|
53 | + 31, 45, 67, 216, 183, 123, 164, 118, 196, 23, 73, 236, 127, 12, 111, 246, |
|
54 | + 108, 161, 59, 82, 41, 157, 85, 170, 251, 96, 134, 177, 187, 204, 62, 90, |
|
55 | + 203, 89, 95, 176, 156, 169, 160, 81, 11, 245, 22, 235, 122, 117, 44, 215, |
|
56 | + 79, 174, 213, 233, 230, 231, 173, 232, 116, 214, 244, 234, 168, 80, 88, 175, |
|
57 | 57 | ]; |
58 | 58 | |
59 | 59 | private const expTable = [ |
60 | - 1, 2, 4, 8, 16, 32, 64, 128, 29, 58, 116, 232, 205, 135, 19, 38, |
|
61 | - 76, 152, 45, 90, 180, 117, 234, 201, 143, 3, 6, 12, 24, 48, 96, 192, |
|
62 | - 157, 39, 78, 156, 37, 74, 148, 53, 106, 212, 181, 119, 238, 193, 159, 35, |
|
63 | - 70, 140, 5, 10, 20, 40, 80, 160, 93, 186, 105, 210, 185, 111, 222, 161, |
|
64 | - 95, 190, 97, 194, 153, 47, 94, 188, 101, 202, 137, 15, 30, 60, 120, 240, |
|
65 | - 253, 231, 211, 187, 107, 214, 177, 127, 254, 225, 223, 163, 91, 182, 113, 226, |
|
66 | - 217, 175, 67, 134, 17, 34, 68, 136, 13, 26, 52, 104, 208, 189, 103, 206, |
|
67 | - 129, 31, 62, 124, 248, 237, 199, 147, 59, 118, 236, 197, 151, 51, 102, 204, |
|
68 | - 133, 23, 46, 92, 184, 109, 218, 169, 79, 158, 33, 66, 132, 21, 42, 84, |
|
69 | - 168, 77, 154, 41, 82, 164, 85, 170, 73, 146, 57, 114, 228, 213, 183, 115, |
|
70 | - 230, 209, 191, 99, 198, 145, 63, 126, 252, 229, 215, 179, 123, 246, 241, 255, |
|
71 | - 227, 219, 171, 75, 150, 49, 98, 196, 149, 55, 110, 220, 165, 87, 174, 65, |
|
72 | - 130, 25, 50, 100, 200, 141, 7, 14, 28, 56, 112, 224, 221, 167, 83, 166, |
|
73 | - 81, 162, 89, 178, 121, 242, 249, 239, 195, 155, 43, 86, 172, 69, 138, 9, |
|
74 | - 18, 36, 72, 144, 61, 122, 244, 245, 247, 243, 251, 235, 203, 139, 11, 22, |
|
75 | - 44, 88, 176, 125, 250, 233, 207, 131, 27, 54, 108, 216, 173, 71, 142, 1, |
|
60 | + 1, 2, 4, 8, 16, 32, 64, 128, 29, 58, 116, 232, 205, 135, 19, 38, |
|
61 | + 76, 152, 45, 90, 180, 117, 234, 201, 143, 3, 6, 12, 24, 48, 96, 192, |
|
62 | + 157, 39, 78, 156, 37, 74, 148, 53, 106, 212, 181, 119, 238, 193, 159, 35, |
|
63 | + 70, 140, 5, 10, 20, 40, 80, 160, 93, 186, 105, 210, 185, 111, 222, 161, |
|
64 | + 95, 190, 97, 194, 153, 47, 94, 188, 101, 202, 137, 15, 30, 60, 120, 240, |
|
65 | + 253, 231, 211, 187, 107, 214, 177, 127, 254, 225, 223, 163, 91, 182, 113, 226, |
|
66 | + 217, 175, 67, 134, 17, 34, 68, 136, 13, 26, 52, 104, 208, 189, 103, 206, |
|
67 | + 129, 31, 62, 124, 248, 237, 199, 147, 59, 118, 236, 197, 151, 51, 102, 204, |
|
68 | + 133, 23, 46, 92, 184, 109, 218, 169, 79, 158, 33, 66, 132, 21, 42, 84, |
|
69 | + 168, 77, 154, 41, 82, 164, 85, 170, 73, 146, 57, 114, 228, 213, 183, 115, |
|
70 | + 230, 209, 191, 99, 198, 145, 63, 126, 252, 229, 215, 179, 123, 246, 241, 255, |
|
71 | + 227, 219, 171, 75, 150, 49, 98, 196, 149, 55, 110, 220, 165, 87, 174, 65, |
|
72 | + 130, 25, 50, 100, 200, 141, 7, 14, 28, 56, 112, 224, 221, 167, 83, 166, |
|
73 | + 81, 162, 89, 178, 121, 242, 249, 239, 195, 155, 43, 86, 172, 69, 138, 9, |
|
74 | + 18, 36, 72, 144, 61, 122, 244, 245, 247, 243, 251, 235, 203, 139, 11, 22, |
|
75 | + 44, 88, 176, 125, 250, 233, 207, 131, 27, 54, 108, 216, 173, 71, 142, 1, |
|
76 | 76 | ]; |
77 | 77 | |
78 | 78 | /** |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @return int sum/difference of a and b |
82 | 82 | */ |
83 | 83 | public static function addOrSubtract(int $a, int $b):int{ |
84 | - return $a ^ $b; |
|
84 | + return $a^$b; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -33,15 +33,15 @@ |
||
33 | 33 | QRMatrix::M_LOGO => false, |
34 | 34 | QRMatrix::M_TEST => false, |
35 | 35 | // dark |
36 | - QRMatrix::M_DARKMODULE | QRMatrix::IS_DARK => true, |
|
37 | - QRMatrix::M_DATA | QRMatrix::IS_DARK => true, |
|
38 | - QRMatrix::M_FINDER | QRMatrix::IS_DARK => true, |
|
39 | - QRMatrix::M_ALIGNMENT | QRMatrix::IS_DARK => true, |
|
40 | - QRMatrix::M_TIMING | QRMatrix::IS_DARK => true, |
|
41 | - QRMatrix::M_FORMAT | QRMatrix::IS_DARK => true, |
|
42 | - QRMatrix::M_VERSION | QRMatrix::IS_DARK => true, |
|
43 | - QRMatrix::M_FINDER_DOT | QRMatrix::IS_DARK => true, |
|
44 | - QRMatrix::M_TEST | QRMatrix::IS_DARK => true, |
|
36 | + QRMatrix::M_DARKMODULE|QRMatrix::IS_DARK => true, |
|
37 | + QRMatrix::M_DATA|QRMatrix::IS_DARK => true, |
|
38 | + QRMatrix::M_FINDER|QRMatrix::IS_DARK => true, |
|
39 | + QRMatrix::M_ALIGNMENT|QRMatrix::IS_DARK => true, |
|
40 | + QRMatrix::M_TIMING|QRMatrix::IS_DARK => true, |
|
41 | + QRMatrix::M_FORMAT|QRMatrix::IS_DARK => true, |
|
42 | + QRMatrix::M_VERSION|QRMatrix::IS_DARK => true, |
|
43 | + QRMatrix::M_FINDER_DOT|QRMatrix::IS_DARK => true, |
|
44 | + QRMatrix::M_TEST|QRMatrix::IS_DARK => true, |
|
45 | 45 | ]; |
46 | 46 | |
47 | 47 | /** |
@@ -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 |
@@ -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 | } |
@@ -60,7 +60,7 @@ |
||
60 | 60 | protected function setLuminancePixels():void{ |
61 | 61 | |
62 | 62 | if($this->options->readerGrayscale){ |
63 | - imagefilter($this->gdImage, IMG_FILTER_GRAYSCALE); |
|
63 | + imagefilter($this->gdImage, IMG_FILTER_GRAYSCALE); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | if($this->options->readerIncreaseContrast){ |
@@ -178,7 +178,7 @@ |
||
178 | 178 | // Above should work but fails on some Apple and Linux JDKs due to a Hotspot bug. |
179 | 179 | // Below is a funny-looking workaround from Steven Parkes |
180 | 180 | $term = GF256::multiply($errorLocations[$j], $xiInverse); |
181 | - $denominator = GF256::multiply($denominator, (($term & 0x1) === 0 ? $term | 1 : $term & ~1)); |
|
181 | + $denominator = GF256::multiply($denominator, (($term & 0x1) === 0 ? $term|1 : $term & ~1)); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 |
@@ -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 | } |
@@ -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'); |
@@ -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){ |