Passed
Push — main ( a9949d...738294 )
by smiley
01:55
created
src/Detector/GridSampler.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -152,7 +152,8 @@
 block discarded – undo
152 152
 					}
153 153
 				}
154 154
 			}
155
-			catch(Exception $aioobe){//ArrayIndexOutOfBoundsException
155
+			catch(Exception $aioobe){
156
+//ArrayIndexOutOfBoundsException
156 157
 				// This feels wrong, but, sometimes if the finder patterns are misidentified, the resulting
157 158
 				// transform gets "twisted" such that it maps a straight line of points to a set of points
158 159
 				// whose endpoints are in bounds, but others are not. There is probably some mathematical
Please login to merge, or discard this patch.
src/Detector/FinderPatternFinder.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -580,7 +580,7 @@
 block discarded – undo
580 580
 					$this->hasSkipped = true;
581 581
 
582 582
 					return (int)((abs($firstConfirmedCenter->getX() - $center->getX()) -
583
-					              abs($firstConfirmedCenter->getY() - $center->getY())) / 2);
583
+								  abs($firstConfirmedCenter->getY() - $center->getY())) / 2);
584 584
 				}
585 585
 			}
586 586
 		}
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 				// Black pixel
79 79
 				if($this->bitMatrix->get($j, $i)){
80 80
 					// Counting white pixels
81
-					if(($currentState & 1) === 1){
81
+					if(($currentState&1) === 1){
82 82
 						$currentState++;
83 83
 					}
84 84
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 				// White pixel
88 88
 				else{
89 89
 					// Counting black pixels
90
-					if(($currentState & 1) === 0){
90
+					if(($currentState&1) === 0){
91 91
 						// A winner?
92 92
 						if($currentState === 4){
93 93
 							// Yes
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 	 *
340 340
 	 * @return float|null vertical center of finder pattern, or null if not found
341 341
 	 */
342
-	private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal):?float{
342
+	private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal): ?float{
343 343
 		$maxI       = $this->bitMatrix->getDimension();
344 344
 		$stateCount = $this->getCrossCheckStateCount();
345 345
 
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 	 * except it reads horizontally instead of vertically. This is used to cross-cross
423 423
 	 * check a vertical cross check and locate the real center of the alignment pattern.</p>
424 424
 	 */
425
-	private function crossCheckHorizontal(int $startJ, int $centerI, int $maxCount, int $originalStateCountTotal):?float{
425
+	private function crossCheckHorizontal(int $startJ, int $centerI, int $maxCount, int $originalStateCountTotal): ?float{
426 426
 		$maxJ       = $this->bitMatrix->getDimension();
427 427
 		$stateCount = $this->getCrossCheckStateCount();
428 428
 
Please login to merge, or discard this patch.
src/Detector/AlignmentPatternFinder.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,7 +88,8 @@
 block discarded – undo
88 88
 
89 89
 				if($this->bitMatrix->get($j, $i)){
90 90
 					// Black pixel
91
-					if($currentState === 1){ // Counting black pixels
91
+					if($currentState === 1){
92
+// Counting black pixels
92 93
 						$stateCount[$currentState]++;
93 94
 					}
94 95
 					// Counting white pixels
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @return \chillerlan\QRCode\Detector\AlignmentPattern|null
60 60
 	 */
61
-	public function find(int $startX, int $startY, int $width, int $height):?AlignmentPattern{
61
+	public function find(int $startX, int $startY, int $width, int $height): ?AlignmentPattern{
62 62
 		$maxJ       = $startX + $width;
63 63
 		$middleI    = $startY + ($height / 2);
64 64
 		$stateCount = [];
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		// this tracks the number of black/white/black modules seen so far
68 68
 		for($iGen = 0; $iGen < $height; $iGen++){
69 69
 			// Search from middle outwards
70
-			$i             = (int)($middleI + (($iGen & 0x01) === 0 ? ($iGen + 1) / 2 : -(($iGen + 1) / 2)));
70
+			$i             = (int)($middleI + (($iGen&0x01) === 0 ? ($iGen + 1) / 2 : -(($iGen + 1) / 2)));
71 71
 			$stateCount[0] = 0;
72 72
 			$stateCount[1] = 0;
73 73
 			$stateCount[2] = 0;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 *
175 175
 	 * @return \chillerlan\QRCode\Detector\AlignmentPattern|null if we have found the same pattern twice, or null if not
176 176
 	 */
177
-	private function handlePossibleCenter(array $stateCount, int $i, int $j):?AlignmentPattern{
177
+	private function handlePossibleCenter(array $stateCount, int $i, int $j): ?AlignmentPattern{
178 178
 		$stateCountTotal = $stateCount[0] + $stateCount[1] + $stateCount[2];
179 179
 		$centerJ         = $this->centerFromEnd($stateCount, $j);
180 180
 		$centerI         = $this->crossCheckVertical($i, (int)$centerJ, 2 * $stateCount[1], $stateCountTotal);
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	 *
224 224
 	 * @return float|null vertical center of alignment pattern, or null if not found
225 225
 	 */
226
-	private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal):?float{
226
+	private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal): ?float{
227 227
 		$maxI          = $this->bitMatrix->getDimension();
228 228
 		$stateCount    = [];
229 229
 		$stateCount[0] = 0;
Please login to merge, or discard this patch.
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/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/Data/ECI.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,19 +57,19 @@
 block discarded – undo
57 57
 	public static function parseValue(BitBuffer $bitBuffer):ECICharset{
58 58
 		$firstByte = $bitBuffer->read(8);
59 59
 
60
-		if(($firstByte & 0x80) === 0){
60
+		if(($firstByte&0x80) === 0){
61 61
 			// just one byte
62
-			return new ECICharset($firstByte & 0x7f);
62
+			return new ECICharset($firstByte&0x7f);
63 63
 		}
64 64
 
65
-		if(($firstByte & 0xc0) === 0x80){
65
+		if(($firstByte&0xc0) === 0x80){
66 66
 			// two bytes
67
-			return new ECICharset((($firstByte & 0x3f) << 8) | $bitBuffer->read(8));
67
+			return new ECICharset((($firstByte&0x3f) << 8)|$bitBuffer->read(8));
68 68
 		}
69 69
 
70
-		if(($firstByte & 0xe0) === 0xC0){
70
+		if(($firstByte&0xe0) === 0xC0){
71 71
 			// three bytes
72
-			return new ECICharset((($firstByte & 0x1f) << 16) | $bitBuffer->read(16));
72
+			return new ECICharset((($firstByte&0x1f) << 16)|$bitBuffer->read(16));
73 73
 		}
74 74
 
75 75
 		throw new QRCodeDataException('error decoding ECI value');
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
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		$offset = (int)($y * $this->rowSize + ($x / 0x20));
38 38
 
39 39
 		$this->bits[$offset] ??= 0;
40
-		$this->bits[$offset] |= ($this->bits[$offset] |= 1 << ($x & 0x1f));
40
+		$this->bits[$offset] |= ($this->bits[$offset] |= 1 << ($x&0x1f));
41 41
 	}
42 42
 
43 43
 	/**
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	public function flip(int $x, int $y):void{
50 50
 		$offset = $y * $this->rowSize + (int)($x / 0x20);
51 51
 
52
-		$this->bits[$offset] = ($this->bits[$offset] ^ (1 << ($x & 0x1f)));
52
+		$this->bits[$offset] = ($this->bits[$offset]^(1 << ($x&0x1f)));
53 53
 	}
54 54
 
55 55
 	/**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
 			for($x = $left; $x < $right; $x++){
86 86
 				$xOffset              = $yOffset + (int)($x / 0x20);
87
-				$this->bits[$xOffset] = ($this->bits[$xOffset] |= 1 << ($x & 0x1f));
87
+				$this->bits[$xOffset] = ($this->bits[$xOffset] |= 1 << ($x&0x1f));
88 88
 			}
89 89
 		}
90 90
 	}
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
 		$this->bits[$offset] ??= 0;
111 111
 
112
-		return (BitMatrixParser::uRShift($this->bits[$offset], ($x & 0x1f)) & 1) !== 0;
112
+		return (BitMatrixParser::uRShift($this->bits[$offset], ($x&0x1f))&1) !== 0;
113 113
 	}
114 114
 
115 115
 	/**
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.