Passed
Push — main ( 5a110e...bb73f7 )
by smiley
35:01
created
src/Decoder/BitMatrix.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	public function flip(int $x, int $y):self{
61 61
 		$offset = $y * $this->rowSize + (int)($x / 0x20);
62 62
 
63
-		$this->bits[$offset] = ($this->bits[$offset] ^ (1 << ($x & 0x1f)));
63
+		$this->bits[$offset] = ($this->bits[$offset]^(1 << ($x & 0x1f)));
64 64
 
65 65
 		return $this;
66 66
 	}
@@ -114,14 +114,14 @@  discard block
 block discarded – undo
114 114
 	/**
115 115
 	 *
116 116
 	 */
117
-	public function getFormatInfo():?FormatInformation{
117
+	public function getFormatInfo(): ?FormatInformation{
118 118
 		return $this->formatInfo;
119 119
 	}
120 120
 
121 121
 	/**
122 122
 	 *
123 123
 	 */
124
-	public function getVersion():?Version{
124
+	public function getVersion(): ?Version{
125 125
 		return $this->version;
126 126
 	}
127 127
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 			? $this->get($j, $i)
247 247
 			: $this->get($i, $j);
248 248
 
249
-		return $bit ? ($versionBits << 1) | 0x1 : $versionBits << 1;
249
+		return $bit ? ($versionBits << 1)|0x1 : $versionBits << 1;
250 250
 	}
251 251
 
252 252
 	/**
@@ -363,8 +363,8 @@  discard block
 block discarded – undo
363 363
 		// Should return null, but, some QR codes apparently do not mask this info.
364 364
 		// Try again by actually masking the pattern first.
365 365
 		$this->formatInfo = $this->doDecodeFormatInformation(
366
-			$formatInfoBits1 ^ FormatInformation::FORMAT_INFO_MASK_QR,
367
-			$formatInfoBits2 ^ FormatInformation::FORMAT_INFO_MASK_QR
366
+			$formatInfoBits1^FormatInformation::FORMAT_INFO_MASK_QR,
367
+			$formatInfoBits2^FormatInformation::FORMAT_INFO_MASK_QR
368 368
 		);
369 369
 
370 370
 		if($this->formatInfo !== null){
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 	 * @return \chillerlan\QRCode\Common\FormatInformation|null information about the format it specifies, or null
383 383
 	 *                                                          if doesn't seem to match any known pattern
384 384
 	 */
385
-	private function doDecodeFormatInformation(int $maskedFormatInfo1, int $maskedFormatInfo2):?FormatInformation{
385
+	private function doDecodeFormatInformation(int $maskedFormatInfo1, int $maskedFormatInfo2): ?FormatInformation{
386 386
 		// Find the int in FORMAT_INFO_DECODE_LOOKUP with fewest bits differing
387 387
 		$bestDifference = PHP_INT_MAX;
388 388
 		$bestFormatInfo = 0;
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 	 *
479 479
 	 * @return \chillerlan\QRCode\Common\Version|null
480 480
 	 */
481
-	private function decodeVersionInformation(int $versionBits):?Version{
481
+	private function decodeVersionInformation(int $versionBits): ?Version{
482 482
 		$bestDifference = PHP_INT_MAX;
483 483
 		$bestVersion    = 0;
484 484
 
Please login to merge, or discard this patch.
src/Decoder/Binarizer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
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
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
 					for($xx = 0; $xx < self::BLOCK_SIZE; $xx++){
238 238
 						$pixel = (int)($luminances[(int)($offset + $xx)]) & 0xff;
239
-						$sum   += $pixel;
239
+						$sum += $pixel;
240 240
 						// still looking for good contrast
241 241
 						if($pixel < $min){
242 242
 							$min = $pixel;
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
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);
Please login to merge, or discard this patch.