@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @inheritDoc |
48 | 48 | */ |
49 | 49 | public function dump(string $file = null){ |
50 | - $file ??= $this->options->cachefile; |
|
50 | + $file ??= $this->options->cachefile; |
|
51 | 51 | $saveToFile = $file !== null; |
52 | 52 | |
53 | 53 | switch($this->options->outputType){ |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | $cssClass = implode(' ', [ |
189 | 189 | 'qr-'.$M_TYPE, |
190 | - ($M_TYPE & QRMatrix::IS_DARK) === QRMatrix::IS_DARK ? 'dark' : 'light', |
|
190 | + ($M_TYPE&QRMatrix::IS_DARK) === QRMatrix::IS_DARK ? 'dark' : 'light', |
|
191 | 191 | $this->options->cssClass, |
192 | 192 | ]); |
193 | 193 |
@@ -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){ |
@@ -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; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | throw new QRCodeDataException(sprintf('illegal char at %d [%d]', $i + 1, $c)); |
102 | 102 | } |
103 | 103 | |
104 | - $bitBuffer->put(((($c >> 8) & 0xff) * 0xc0) + ($c & 0xff), 13); |
|
104 | + $bitBuffer->put(((($c >> 8)&0xff) * 0xc0) + ($c&0xff), 13); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | if($i < $len){ |
@@ -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 | - $buffer[$offset] = chr(0xff & ($assembledTwoBytes >> 8)); |
|
138 | - $buffer[$offset + 1] = chr(0xff & $assembledTwoBytes); |
|
139 | - $offset += 2; |
|
137 | + $buffer[$offset] = chr(0xff&($assembledTwoBytes >> 8)); |
|
138 | + $buffer[$offset + 1] = chr(0xff&$assembledTwoBytes); |
|
139 | + $offset += 2; |
|
140 | 140 | $length--; |
141 | 141 | } |
142 | 142 |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | // This class uses 5x5 blocks to compute local luminance, where each block is 8x8 pixels. |
36 | 36 | // So this is the smallest dimension in each axis we can accept. |
37 | 37 | private const BLOCK_SIZE_POWER = 3; |
38 | - private const BLOCK_SIZE = 8; // ...0100...00 |
|
39 | - private const BLOCK_SIZE_MASK = 7; // ...0011...11 |
|
38 | + private const BLOCK_SIZE = 8; // ...0100...00 |
|
39 | + private const BLOCK_SIZE_MASK = 7; // ...0011...11 |
|
40 | 40 | private const MINIMUM_DIMENSION = 40; |
41 | 41 | private const MIN_DYNAMIC_RANGE = 24; |
42 | 42 | |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | if($width >= self::MINIMUM_DIMENSION && $height >= self::MINIMUM_DIMENSION){ |
140 | 140 | $subWidth = $width >> self::BLOCK_SIZE_POWER; |
141 | 141 | |
142 | - if(($width & self::BLOCK_SIZE_MASK) !== 0){ |
|
142 | + if(($width&self::BLOCK_SIZE_MASK) !== 0){ |
|
143 | 143 | $subWidth++; |
144 | 144 | } |
145 | 145 | |
146 | 146 | $subHeight = $height >> self::BLOCK_SIZE_POWER; |
147 | 147 | |
148 | - if(($height & self::BLOCK_SIZE_MASK) !== 0){ |
|
148 | + if(($height&self::BLOCK_SIZE_MASK) !== 0){ |
|
149 | 149 | $subHeight++; |
150 | 150 | } |
151 | 151 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $right = (int)(($width * 4) / 5); |
173 | 173 | |
174 | 174 | for($x = (int)($width / 5); $x < $right; $x++){ |
175 | - $pixel = $localLuminances[(int)$x] & 0xff; |
|
175 | + $pixel = $localLuminances[(int)$x]&0xff; |
|
176 | 176 | $buckets[$pixel >> self::LUMINANCE_SHIFT]++; |
177 | 177 | } |
178 | 178 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $offset = $y * $width; |
189 | 189 | |
190 | 190 | for($x = 0; $x < $width; $x++){ |
191 | - $pixel = (int)($localLuminances[$offset + $x] & 0xff); |
|
191 | + $pixel = (int)($localLuminances[$offset + $x]&0xff); |
|
192 | 192 | |
193 | 193 | if($pixel < $blackPoint){ |
194 | 194 | $matrix->set($x, $y); |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | for($yy = 0, $offset = $yoffset * $width + $xoffset; $yy < self::BLOCK_SIZE; $yy++, $offset += $width){ |
236 | 236 | |
237 | 237 | for($xx = 0; $xx < self::BLOCK_SIZE; $xx++){ |
238 | - $pixel = (int)($luminances[(int)($offset + $xx)]) & 0xff; |
|
239 | - $sum += $pixel; |
|
238 | + $pixel = (int)($luminances[(int)($offset + $xx)])&0xff; |
|
239 | + $sum += $pixel; |
|
240 | 240 | // still looking for good contrast |
241 | 241 | if($pixel < $min){ |
242 | 242 | $min = $pixel; |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | // finish the rest of the rows quickly |
253 | 253 | for($yy++, $offset += $width; $yy < self::BLOCK_SIZE; $yy++, $offset += $width){ |
254 | 254 | for($xx = 0; $xx < self::BLOCK_SIZE; $xx++){ |
255 | - $sum += (int)($luminances[(int)($offset + $xx)]) & 0xff; |
|
255 | + $sum += (int)($luminances[(int)($offset + $xx)])&0xff; |
|
256 | 256 | } |
257 | 257 | } |
258 | 258 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | |
331 | 331 | for($z = -2; $z <= 2; $z++){ |
332 | 332 | $blackRow = $blackPoints[$top + $z]; |
333 | - $sum += $blackRow[$left - 2] + $blackRow[$left - 1] + $blackRow[$left] + $blackRow[$left + 1] + $blackRow[$left + 2]; |
|
333 | + $sum += $blackRow[$left - 2] + $blackRow[$left - 1] + $blackRow[$left] + $blackRow[$left + 1] + $blackRow[$left + 2]; |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | $average = (int)($sum / 25); |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | for($j = 0, $o = $yoffset * $width + $xoffset; $j < self::BLOCK_SIZE; $j++, $o += $width){ |
340 | 340 | for($i = 0; $i < self::BLOCK_SIZE; $i++){ |
341 | 341 | // Comparison needs to be <= so that black == 0 pixels are black even if the threshold is 0. |
342 | - if(((int)($luminances[$o + $i]) & 0xff) <= $average){ |
|
342 | + if(((int)($luminances[$o + $i])&0xff) <= $average){ |
|
343 | 343 | $matrix->set($xoffset + $i, $yoffset + $j); |
344 | 344 | } |
345 | 345 | } |
@@ -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 |