Passed
Push — main ( 4e03cd...17d0bc )
by smiley
01:59
created
src/Decoder/BitMatrixParser.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 			? $this->bitMatrix->get($j, $i)
68 68
 			: $this->bitMatrix->get($i, $j);
69 69
 
70
-		return $bit ? ($versionBits << 1) | 0x1 : $versionBits << 1;
70
+		return $bit ? ($versionBits << 1)|0x1 : $versionBits << 1;
71 71
 	}
72 72
 
73 73
 	/**
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 		// Should return null, but, some QR codes apparently do not mask this info.
187 187
 		// Try again by actually masking the pattern first.
188 188
 		$this->parsedFormatInfo = $this->doDecodeFormatInformation(
189
-			$formatInfoBits1 ^ FormatInformation::MASK_QR,
190
-			$formatInfoBits2 ^ FormatInformation::MASK_QR
189
+			$formatInfoBits1^FormatInformation::MASK_QR,
190
+			$formatInfoBits2^FormatInformation::MASK_QR
191 191
 		);
192 192
 
193 193
 		if($this->parsedFormatInfo !== null){
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	 * @return \chillerlan\QRCode\Common\FormatInformation|null information about the format it specifies, or null
206 206
 	 *                                                          if doesn't seem to match any known pattern
207 207
 	 */
208
-	private function doDecodeFormatInformation(int $maskedFormatInfo1, int $maskedFormatInfo2):?FormatInformation{
208
+	private function doDecodeFormatInformation(int $maskedFormatInfo1, int $maskedFormatInfo2): ?FormatInformation{
209 209
 		// Find the int in FORMAT_INFO_DECODE_LOOKUP with fewest bits differing
210 210
 		$bestDifference = PHP_INT_MAX;
211 211
 		$bestFormatInfo = 0;
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	 *
303 303
 	 * @return \chillerlan\QRCode\Common\Version|null
304 304
 	 */
305
-	private function decodeVersionInformation(int $versionBits):?Version{
305
+	private function decodeVersionInformation(int $versionBits): ?Version{
306 306
 		$bestDifference = PHP_INT_MAX;
307 307
 		$bestVersion    = 0;
308 308
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 			return $a;
342 342
 		}
343 343
 
344
-		return ($a >> $b) & ~((1 << (8 * PHP_INT_SIZE - 1)) >> ($b - 1));
344
+		return ($a >> $b)&~((1 << (8 * PHP_INT_SIZE - 1)) >> ($b - 1));
345 345
 	}
346 346
 
347 347
 	private static function numBitsDiffering(int $a, int $b):int{
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 		$count = 0;
354 354
 
355 355
 		for($i = 0; $i < 32; $i += 4){
356
-			$count += $BITS_SET_IN_HALF_BYTE[self::uRShift($a, $i) & 0x0F];
356
+			$count += $BITS_SET_IN_HALF_BYTE[self::uRShift($a, $i)&0x0F];
357 357
 		}
358 358
 
359 359
 		return $count;
Please login to merge, or discard this patch.
src/Decoder/Binarizer.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 	// This class uses 5x5 blocks to compute local luminance, where each block is 8x8 pixels.
37 37
 	// So this is the smallest dimension in each axis we can accept.
38 38
 	private const BLOCK_SIZE_POWER  = 3;
39
-	private const BLOCK_SIZE        = 8;  // ...0100...00
40
-	private const BLOCK_SIZE_MASK   = 7;  // ...0011...11
39
+	private const BLOCK_SIZE        = 8; // ...0100...00
40
+	private const BLOCK_SIZE_MASK   = 7; // ...0011...11
41 41
 	private const MINIMUM_DIMENSION = 40;
42 42
 	private const MIN_DYNAMIC_RANGE = 24;
43 43
 
@@ -137,13 +137,13 @@  discard block
 block discarded – undo
137 137
 		if($width >= self::MINIMUM_DIMENSION && $height >= self::MINIMUM_DIMENSION){
138 138
 			$subWidth = $width >> self::BLOCK_SIZE_POWER;
139 139
 
140
-			if(($width & self::BLOCK_SIZE_MASK) !== 0){
140
+			if(($width&self::BLOCK_SIZE_MASK) !== 0){
141 141
 				$subWidth++;
142 142
 			}
143 143
 
144 144
 			$subHeight = $height >> self::BLOCK_SIZE_POWER;
145 145
 
146
-			if(($height & self::BLOCK_SIZE_MASK) !== 0){
146
+			if(($height&self::BLOCK_SIZE_MASK) !== 0){
147 147
 				$subHeight++;
148 148
 			}
149 149
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 			$right           = (int)(($width * 4) / 5);
168 168
 
169 169
 			for($x = (int)($width / 5); $x < $right; $x++){
170
-				$pixel = $localLuminances[(int)$x] & 0xff;
170
+				$pixel = $localLuminances[(int)$x]&0xff;
171 171
 				$buckets[$pixel >> self::LUMINANCE_SHIFT]++;
172 172
 			}
173 173
 		}
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 			$offset = $y * $width;
184 184
 
185 185
 			for($x = 0; $x < $width; $x++){
186
-				$pixel = (int)($localLuminances[$offset + $x] & 0xff);
186
+				$pixel = (int)($localLuminances[$offset + $x]&0xff);
187 187
 
188 188
 				if($pixel < $blackPoint){
189 189
 					$matrix->set($x, $y);
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
 				for($yy = 0, $offset = $yoffset * $width + $xoffset; $yy < self::BLOCK_SIZE; $yy++, $offset += $width){
231 231
 
232 232
 					for($xx = 0; $xx < self::BLOCK_SIZE; $xx++){
233
-						$pixel = (int)($luminances[(int)($offset + $xx)]) & 0xff;
234
-						$sum   += $pixel;
233
+						$pixel = (int)($luminances[(int)($offset + $xx)])&0xff;
234
+						$sum += $pixel;
235 235
 						// still looking for good contrast
236 236
 						if($pixel < $min){
237 237
 							$min = $pixel;
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 						// finish the rest of the rows quickly
248 248
 						for($yy++, $offset += $width; $yy < self::BLOCK_SIZE; $yy++, $offset += $width){
249 249
 							for($xx = 0; $xx < self::BLOCK_SIZE; $xx++){
250
-								$sum += $luminances[$offset + $xx] & 0xff;
250
+								$sum += $luminances[$offset + $xx]&0xff;
251 251
 							}
252 252
 						}
253 253
 					}
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 
326 326
 				for($z = -2; $z <= 2; $z++){
327 327
 					$blackRow = $blackPoints[$top + $z];
328
-					$sum      += $blackRow[$left - 2] + $blackRow[$left - 1] + $blackRow[$left] + $blackRow[$left + 1] + $blackRow[$left + 2];
328
+					$sum += $blackRow[$left - 2] + $blackRow[$left - 1] + $blackRow[$left] + $blackRow[$left + 1] + $blackRow[$left + 2];
329 329
 				}
330 330
 
331 331
 				$average = (int)($sum / 25);
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 				for($j = 0, $o = $yoffset * $width + $xoffset; $j < self::BLOCK_SIZE; $j++, $o += $width){
335 335
 					for($i = 0; $i < self::BLOCK_SIZE; $i++){
336 336
 						// Comparison needs to be <= so that black == 0 pixels are black even if the threshold is 0.
337
-						if(($luminances[$o + $i] & 0xff) <= $average){
337
+						if(($luminances[$o + $i]&0xff) <= $average){
338 338
 							$matrix->set($xoffset + $i, $yoffset + $j);
339 339
 						}
340 340
 					}
Please login to merge, or discard this patch.
src/Common/ECICharset.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -18,16 +18,16 @@  discard block
 block discarded – undo
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
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		return $this->charsetID;
103 103
 	}
104 104
 
105
-	public function getName():?string{
105
+	public function getName(): ?string{
106 106
 		return self::MB_ENCODINGS[$this->charsetID];
107 107
 	}
108 108
 
Please login to merge, or discard this patch.
src/Data/QRMatrix.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 			$matrix[$y] = [];
122 122
 
123 123
 			foreach($row as $x => $val){
124
-				$matrix[$y][$x] = ($val & $this::IS_DARK) === $this::IS_DARK;
124
+				$matrix[$y][$x] = ($val&$this::IS_DARK) === $this::IS_DARK;
125 125
 			}
126 126
 		}
127 127
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	/**
146 146
 	 * Returns the current mask pattern
147 147
 	 */
148
-	public function maskPattern():?MaskPattern{
148
+	public function maskPattern(): ?MaskPattern{
149 149
 		return $this->maskPattern;
150 150
 	}
151 151
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	 *   false => $M_TYPE
173 173
 	 */
174 174
 	public function set(int $x, int $y, bool $value, int $M_TYPE):self{
175
-		$this->matrix[$y][$x] = $M_TYPE | ($value ? $this::IS_DARK : 0);
175
+		$this->matrix[$y][$x] = $M_TYPE|($value ? $this::IS_DARK : 0);
176 176
 
177 177
 		return $this;
178 178
 	}
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 *   true => $value & $M_TYPE === $M_TYPE
193 193
 	 */
194 194
 	public function checkType(int $x, int $y, int $M_TYPE):bool{
195
-		return ($this->matrix[$y][$x] & $M_TYPE) === $M_TYPE;
195
+		return ($this->matrix[$y][$x]&$M_TYPE) === $M_TYPE;
196 196
 	}
197 197
 
198 198
 	/**
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 
271 271
 		for($c = 0; $c < 3; $c++){
272 272
 			for($i = 0; $i < 8; $i++){
273
-				$this->set($h[$c][0]     , $h[$c][1] + $i, false, $this::M_SEPARATOR);
274
-				$this->set($v[$c][0] - $i, $v[$c][1]     , false, $this::M_SEPARATOR);
273
+				$this->set($h[$c][0], $h[$c][1] + $i, false, $this::M_SEPARATOR);
274
+				$this->set($v[$c][0] - $i, $v[$c][1], false, $this::M_SEPARATOR);
275 275
 			}
276 276
 		}
277 277
 
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 			for($i = 0; $i < 18; $i++){
346 346
 				$a = (int)($i / 3);
347 347
 				$b = $i % 3 + $this->moduleCount - 8 - 3;
348
-				$v = !$test && (($bits >> $i) & 1) === 1;
348
+				$v = !$test && (($bits >> $i)&1) === 1;
349 349
 
350 350
 				$this->set($b, $a, $v, $this::M_VERSION); // ne
351 351
 				$this->set($a, $b, $v, $this::M_VERSION); // sw
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 		$bits = $this->eccLevel->getformatPattern($maskPattern);
366 366
 
367 367
 		for($i = 0; $i < 15; $i++){
368
-			$v = !$test && (($bits >> $i) & 1) === 1;
368
+			$v = !$test && (($bits >> $i)&1) === 1;
369 369
 
370 370
 			if($i < 6){
371 371
 				$this->set(8, $i, $v, $this::M_FORMAT);
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 		foreach($this->matrix as $y => $row){
488 488
 			foreach($row as $x => $val){
489 489
 				// out of bounds, skip
490
-				if($x < $start || $y < $start ||$x >= $end || $y >= $end){
490
+				if($x < $start || $y < $start || $x >= $end || $y >= $end){
491 491
 					continue;
492 492
 				}
493 493
 				// a match
@@ -531,10 +531,10 @@  discard block
 block discarded – undo
531 531
 						$v = false;
532 532
 
533 533
 						if($byteIndex < $byteCount){
534
-							$v = (($data[$byteIndex] >> $bitIndex) & 1) === 1;
534
+							$v = (($data[$byteIndex] >> $bitIndex)&1) === 1;
535 535
 						}
536 536
 
537
-						$this->matrix[$y][$x] = $this::M_DATA | ($v ? $this::IS_DARK : 0);
537
+						$this->matrix[$y][$x] = $this::M_DATA|($v ? $this::IS_DARK : 0);
538 538
 						$bitIndex--;
539 539
 
540 540
 						if($bitIndex === -1){
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 				$y += $inc;
549 549
 
550 550
 				if($y < 0 || $this->moduleCount <= $y){
551
-					$y   -=  $inc;
551
+					$y   -= $inc;
552 552
 					$inc  = -$inc;
553 553
 
554 554
 					break;
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 
572 572
 		foreach($this->matrix as $y => &$row){
573 573
 			foreach($row as $x => &$val){
574
-				if($mask($x, $y) === 0 && ($val & $this::M_DATA) === $this::M_DATA){
574
+				if($mask($x, $y) === 0 && ($val&$this::M_DATA) === $this::M_DATA){
575 575
 					$val ^= $this::IS_DARK;
576 576
 				}
577 577
 			}
Please login to merge, or discard this patch.
src/Common/BitBuffer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	public function put(int $num, int $length):self{
58 58
 
59 59
 		for($i = 0; $i < $length; $i++){
60
-			$this->putBit((($num >> ($length - $i - 1)) & 1) === 1);
60
+			$this->putBit((($num >> ($length - $i - 1))&1) === 1);
61 61
 		}
62 62
 
63 63
 		return $this;
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 			$toRead         = $numBits < $bitsLeft ? $numBits : $bitsLeft;
127 127
 			$bitsToNotRead  = $bitsLeft - $toRead;
128 128
 			$mask           = (0xff >> (8 - $toRead)) << $bitsToNotRead;
129
-			$result         = ($this->buffer[$this->bytesRead] & $mask) >> $bitsToNotRead;
129
+			$result         = ($this->buffer[$this->bytesRead]&$mask) >> $bitsToNotRead;
130 130
 			$numBits        -= $toRead;
131 131
 			$this->bitsRead += $toRead;
132 132
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		if($numBits > 0){
141 141
 
142 142
 			while($numBits >= 8){
143
-				$result = ($result << 8) | ($this->buffer[$this->bytesRead] & 0xff);
143
+				$result = ($result << 8)|($this->buffer[$this->bytesRead]&0xff);
144 144
 				$this->bytesRead++;
145 145
 				$numBits -= 8;
146 146
 			}
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 			if($numBits > 0){
150 150
 				$bitsToNotRead  = 8 - $numBits;
151 151
 				$mask           = (0xff >> $bitsToNotRead) << $bitsToNotRead;
152
-				$result         = ($result << $numBits) | (($this->buffer[$this->bytesRead] & $mask) >> $bitsToNotRead);
152
+				$result         = ($result << $numBits)|(($this->buffer[$this->bytesRead]&$mask) >> $bitsToNotRead);
153 153
 				$this->bitsRead += $numBits;
154 154
 			}
155 155
 		}
Please login to merge, or discard this patch.