Passed
Push — v5 ( 84eb31...95cac3 )
by smiley
01:49
created
src/Detector/Detector.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		}
162 162
 
163 163
 		$otherToX = (int)($fromX + ($otherToX - $fromX) * $scale);
164
-		$result   += $this->sizeOfBlackWhiteBlackRun((int)$fromX, (int)$fromY, (int)$otherToX, (int)$otherToY);
164
+		$result += $this->sizeOfBlackWhiteBlackRun((int)$fromX, (int)$fromY, (int)$otherToX, (int)$otherToY);
165 165
 
166 166
 		// Middle pixel is double-counted this way; subtract 1
167 167
 		return $result - 1.0;
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 		int $estAlignmentX,
292 292
 		int $estAlignmentY,
293 293
 		float $allowanceFactor
294
-	):?AlignmentPattern{
294
+	): ?AlignmentPattern{
295 295
 		// Look for an alignment pattern (3 modules in size) around where it should be
296 296
 		$dimension           = $this->bitMatrix->getDimension();
297 297
 		$allowance           = (int)($allowanceFactor * $overallEstModuleSize);
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,8 @@
 block discarded – undo
59 59
 			$estAlignmentY       = (int)($topLeft->getY() + $correctionToTopLeft * ($bottomRightY - $topLeft->getY()));
60 60
 
61 61
 			// Kind of arbitrary -- expand search radius before giving up
62
-			for($i = 4; $i <= 16; $i <<= 1){//??????????
62
+			for($i = 4; $i <= 16; $i <<= 1){
63
+//??????????
63 64
 				$alignmentPattern = $this->findAlignmentInRegion($moduleSize, $estAlignmentX, $estAlignmentY, (float)$i);
64 65
 
65 66
 				if($alignmentPattern !== null){
Please login to merge, or discard this patch.
src/Decoder/BitMatrix.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		$offset = (int)($y * $this->rowSize + ($x / 0x20));
39 39
 
40 40
 		$this->bits[$offset] ??= 0;
41
-		$this->bits[$offset] |= ($this->bits[$offset] |= 1 << ($x & 0x1f));
41
+		$this->bits[$offset] |= ($this->bits[$offset] |= 1 << ($x&0x1f));
42 42
 	}
43 43
 
44 44
 	/**
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	public function flip(int $x, int $y):void{
51 51
 		$offset = $y * $this->rowSize + (int)($x / 0x20);
52 52
 
53
-		$this->bits[$offset] = ($this->bits[$offset] ^ (1 << ($x & 0x1f)));
53
+		$this->bits[$offset] = ($this->bits[$offset]^(1 << ($x&0x1f)));
54 54
 	}
55 55
 
56 56
 	/**
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 			for($x = $left; $x < $right; $x++){
87 87
 				$xOffset              = $yOffset + (int)($x / 0x20);
88
-				$this->bits[$xOffset] = ($this->bits[$xOffset] |= 1 << ($x & 0x1f));
88
+				$this->bits[$xOffset] = ($this->bits[$xOffset] |= 1 << ($x&0x1f));
89 89
 			}
90 90
 		}
91 91
 	}
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
 		$this->bits[$offset] ??= 0;
112 112
 
113
-		return (uRShift($this->bits[$offset], ($x & 0x1f)) & 1) !== 0;
113
+		return (uRShift($this->bits[$offset], ($x&0x1f))&1) !== 0;
114 114
 	}
115 115
 
116 116
 	/**
Please login to merge, or discard this patch.
src/Decoder/Binarizer.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	// So this is the smallest dimension in each axis we can accept.
38 38
 	private const BLOCK_SIZE_POWER  = 3;
39 39
 	private const BLOCK_SIZE        = 8; // ...0100...00
40
-	private const BLOCK_SIZE_MASK   = 7;   // ...0011...11
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/Decoder/Decoder.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		$eccLevel = $parser->readFormatInformation()->getErrorCorrectionLevel();
96 96
 
97 97
 		// Read raw codewords
98
-		$rawCodewords  = $parser->readCodewords();
98
+		$rawCodewords = $parser->readCodewords();
99 99
 		// Separate into data blocks
100 100
 		$dataBlocks = $this->getDataBlocks($rawCodewords, $version, $eccLevel);
101 101
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		[$numEccCodewords, $eccBlocks] = $version->getRSBlocks($eccLevel);
141 141
 
142 142
 		// Now establish DataBlocks of the appropriate size and number of data codewords
143
-		$result          = [];//new DataBlock[$totalBlocks];
143
+		$result          = []; //new DataBlock[$totalBlocks];
144 144
 		$numResultBlocks = 0;
145 145
 
146 146
 		foreach($eccBlocks as $blockData){
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 		$codewordsInts = [];
207 207
 
208 208
 		foreach($codewordBytes as $i => $codewordByte){
209
-			$codewordsInts[$i] = $codewordByte & 0xFF;
209
+			$codewordsInts[$i] = $codewordByte&0xFF;
210 210
 		}
211 211
 
212 212
 		$decoded = (new ReedSolomonDecoder)->decode($codewordsInts, (count($codewordBytes) - $numDataCodewords));
Please login to merge, or discard this patch.
src/Decoder/IMagickLuminanceSource.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 		$countPixels = count($pixels);
47 47
 
48 48
 		for($i = 0; $i < $countPixels; $i += 3){
49
-			$this->setLuminancePixel($pixels[$i] & 0xff, $pixels[$i + 1] & 0xff, $pixels[$i + 2] & 0xff);
49
+			$this->setLuminancePixel($pixels[$i]&0xff, $pixels[$i + 1]&0xff, $pixels[$i + 2]&0xff);
50 50
 		}
51 51
 	}
52 52
 
Please login to merge, or discard this patch.
src/Decoder/BitMatrixParser.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 			? $this->bitMatrix->get($j, $i)
69 69
 			: $this->bitMatrix->get($i, $j);
70 70
 
71
-		return $bit ? ($versionBits << 1) | 0x1 : $versionBits << 1;
71
+		return $bit ? ($versionBits << 1)|0x1 : $versionBits << 1;
72 72
 	}
73 73
 
74 74
 	/**
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
 		// Should return null, but, some QR codes apparently do not mask this info.
188 188
 		// Try again by actually masking the pattern first.
189 189
 		$this->parsedFormatInfo = $this->doDecodeFormatInformation(
190
-			$formatInfoBits1 ^ FormatInformation::MASK_QR,
191
-			$formatInfoBits2 ^ FormatInformation::MASK_QR
190
+			$formatInfoBits1^FormatInformation::MASK_QR,
191
+			$formatInfoBits2^FormatInformation::MASK_QR
192 192
 		);
193 193
 
194 194
 		if($this->parsedFormatInfo !== null){
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	 * @return \chillerlan\QRCode\Common\FormatInformation|null information about the format it specifies, or null
207 207
 	 *                                                          if doesn't seem to match any known pattern
208 208
 	 */
209
-	private function doDecodeFormatInformation(int $maskedFormatInfo1, int $maskedFormatInfo2):?FormatInformation{
209
+	private function doDecodeFormatInformation(int $maskedFormatInfo1, int $maskedFormatInfo2): ?FormatInformation{
210 210
 		// Find the int in FORMAT_INFO_DECODE_LOOKUP with fewest bits differing
211 211
 		$bestDifference = PHP_INT_MAX;
212 212
 		$bestFormatInfo = 0;
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 	 *
304 304
 	 * @return \chillerlan\QRCode\Common\Version|null
305 305
 	 */
306
-	private function decodeVersionInformation(int $versionBits):?Version{
306
+	private function decodeVersionInformation(int $versionBits): ?Version{
307 307
 		$bestDifference = PHP_INT_MAX;
308 308
 		$bestVersion    = 0;
309 309
 
Please login to merge, or discard this patch.