Passed
Push — main ( ae0f31...02a232 )
by smiley
02:05
created
src/Common/MaskPattern.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public function __construct(int $maskPattern){
69 69
 
70
-		if((0b111 & $maskPattern) !== $maskPattern){
70
+		if((0b111&$maskPattern) !== $maskPattern){
71 71
 			throw new QRCodeException('invalid mask pattern');
72 72
 		}
73 73
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 						$penalty += (3 + ($numSameBitCells - 5));
162 162
 					}
163 163
 
164
-					$numSameBitCells = 1;  // Include the cell itself.
164
+					$numSameBitCells = 1; // Include the cell itself.
165 165
 					$prevBit         = $bit;
166 166
 				}
167 167
 			}
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
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	/**
39 39
 	 * Read count (bits)
40 40
 	 */
41
-	private int $bitsRead  = 0;
41
+	private int $bitsRead = 0;
42 42
 
43 43
 	/**
44 44
 	 * BitBuffer constructor.
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 			$toRead         = min($numBits, $bitsLeft);
125 125
 			$bitsToNotRead  = ($bitsLeft - $toRead);
126 126
 			$mask           = ((0xff >> (8 - $toRead)) << $bitsToNotRead);
127
-			$result         = (($this->buffer[$this->bytesRead] & $mask) >> $bitsToNotRead);
127
+			$result         = (($this->buffer[$this->bytesRead]&$mask) >> $bitsToNotRead);
128 128
 			$numBits        -= $toRead;
129 129
 			$this->bitsRead += $toRead;
130 130
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 		if($numBits > 0){
139 139
 
140 140
 			while($numBits >= 8){
141
-				$result = (($result << 8) | ($this->buffer[$this->bytesRead] & 0xff));
141
+				$result = (($result << 8)|($this->buffer[$this->bytesRead] & 0xff));
142 142
 				$this->bytesRead++;
143 143
 				$numBits -= 8;
144 144
 			}
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 			if($numBits > 0){
148 148
 				$bitsToNotRead  = (8 - $numBits);
149 149
 				$mask           = ((0xff >> $bitsToNotRead) << $bitsToNotRead);
150
-				$result         = (($result << $numBits) | (($this->buffer[$this->bytesRead] & $mask) >> $bitsToNotRead));
150
+				$result         = (($result << $numBits)|(($this->buffer[$this->bytesRead]&$mask) >> $bitsToNotRead));
151 151
 				$this->bitsRead += $numBits;
152 152
 			}
153 153
 		}
Please login to merge, or discard this patch.
src/Detector/Detector.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 		}
152 152
 
153 153
 		$otherToX = (int)($fromX + ($otherToX - $fromX) * $scale);
154
-		$result   += $this->sizeOfBlackWhiteBlackRun((int)$fromX, (int)$fromY, $otherToX, $otherToY);
154
+		$result += $this->sizeOfBlackWhiteBlackRun((int)$fromX, (int)$fromY, $otherToX, $otherToY);
155 155
 
156 156
 		// Middle pixel is double-counted this way; subtract 1
157 157
 		return ($result - 1.0);
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 		int $estAlignmentX,
277 277
 		int $estAlignmentY,
278 278
 		float $allowanceFactor
279
-	):?AlignmentPattern{
279
+	): ?AlignmentPattern{
280 280
 		// Look for an alignment pattern (3 modules in size) around where it should be
281 281
 		$dimension           = $this->matrix->size();
282 282
 		$allowance           = (int)($allowanceFactor * $overallEstModuleSize);
Please login to merge, or discard this patch.
src/Detector/AlignmentPatternFinder.php 1 patch
Spacing   +3 added lines, -3 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 = [];
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	 *
174 174
 	 * @return \chillerlan\QRCode\Detector\AlignmentPattern|null if we have found the same pattern twice, or null if not
175 175
 	 */
176
-	private function handlePossibleCenter(array $stateCount, int $i, int $j):?AlignmentPattern{
176
+	private function handlePossibleCenter(array $stateCount, int $i, int $j): ?AlignmentPattern{
177 177
 		$stateCountTotal = ($stateCount[0] + $stateCount[1] + $stateCount[2]);
178 178
 		$centerJ         = $this->centerFromEnd($stateCount, $j);
179 179
 		$centerI         = $this->crossCheckVertical($i, (int)$centerJ, (2 * $stateCount[1]), $stateCountTotal);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 *
223 223
 	 * @return float|null vertical center of alignment pattern, or null if not found
224 224
 	 */
225
-	private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal):?float{
225
+	private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal): ?float{
226 226
 		$maxI          = $this->matrix->size();
227 227
 		$stateCount    = [];
228 228
 		$stateCount[0] = 0;
Please login to merge, or discard this patch.
src/Data/Kanji.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 			$byte2 = ord($string[($i + 1)]);
100 100
 
101 101
 			// byte 1 unused and vendor ranges
102
-			if($byte1 < 0x81 || ($byte1 > 0x84 && $byte1 < 0x88) || ($byte1 > 0x9f && $byte1 < 0xe0) ||  $byte1 > 0xea){
102
+			if($byte1 < 0x81 || ($byte1 > 0x84 && $byte1 < 0x88) || ($byte1 > 0x9f && $byte1 < 0xe0) || $byte1 > 0xea){
103 103
 				return false;
104 104
 			}
105 105
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 		$len = strlen($this->data);
129 129
 
130 130
 		for($i = 0; ($i + 1) < $len; $i += 2){
131
-			$c = (((0xff & ord($this->data[$i])) << 8) | (0xff & ord($this->data[($i + 1)])));
131
+			$c = (((0xff & ord($this->data[$i])) << 8)|(0xff & ord($this->data[($i + 1)])));
132 132
 
133 133
 			if($c >= 0x8140 && $c <= 0x9ffc){
134 134
 				$c -= 0x8140;
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 		$length = $bitBuffer->read(self::getLengthBits($versionNumber));
159 159
 
160 160
 		if($bitBuffer->available() < ($length * 13)){
161
-			throw new QRCodeDataException('not enough bits available');  // @codeCoverageIgnore
161
+			throw new QRCodeDataException('not enough bits available'); // @codeCoverageIgnore
162 162
 		}
163 163
 
164 164
 		// Each character will require 2 bytes. Read the characters as 2-byte pairs and decode as SJIS afterwards
@@ -168,15 +168,15 @@  discard block
 block discarded – undo
168 168
 		while($length > 0){
169 169
 			// Each 13 bits encodes a 2-byte character
170 170
 			$twoBytes          = $bitBuffer->read(13);
171
-			$assembledTwoBytes = ((((int)($twoBytes / 0x0c0)) << 8) | ($twoBytes % 0x0c0));
171
+			$assembledTwoBytes = ((((int)($twoBytes / 0x0c0)) << 8)|($twoBytes % 0x0c0));
172 172
 
173 173
 			$assembledTwoBytes += ($assembledTwoBytes < 0x01f00)
174 174
 				? 0x08140  // In the 0x8140 to 0x9FFC range
175 175
 				: 0x0c140; // In the 0xE040 to 0xEBBF range
176 176
 
177 177
 			$buffer[$offset]       = chr(0xff & ($assembledTwoBytes >> 8));
178
-			$buffer[($offset + 1)] = chr(0xff & $assembledTwoBytes);
179
-			$offset                += 2;
178
+			$buffer[($offset + 1)] = chr(0xff&$assembledTwoBytes);
179
+			$offset += 2;
180 180
 			$length--;
181 181
 		}
182 182
 
Please login to merge, or discard this patch.
src/Data/Hanzi.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		$len = strlen($this->data);
132 132
 
133 133
 		for($i = 0; ($i + 1) < $len; $i += 2){
134
-			$c = (((0xff & ord($this->data[$i])) << 8) | (0xff & ord($this->data[($i + 1)])));
134
+			$c = (((0xff & ord($this->data[$i])) << 8)|(0xff & ord($this->data[($i + 1)])));
135 135
 
136 136
 			if($c >= 0xa1a1 && $c <= 0xaafe){
137 137
 				$c -= 0x0a1a1;
@@ -177,15 +177,15 @@  discard block
 block discarded – undo
177 177
 		while($length > 0){
178 178
 			// Each 13 bits encodes a 2-byte character
179 179
 			$twoBytes          = $bitBuffer->read(13);
180
-			$assembledTwoBytes = ((((int)($twoBytes / 0x060)) << 8) | ($twoBytes % 0x060));
180
+			$assembledTwoBytes = ((((int)($twoBytes / 0x060)) << 8)|($twoBytes % 0x060));
181 181
 
182 182
 			$assembledTwoBytes += ($assembledTwoBytes < 0x00a00) // 0x003BF
183 183
 				? 0x0a1a1  // In the 0xA1A1 to 0xAAFE range
184 184
 				: 0x0a6a1; // In the 0xB0A1 to 0xFAFE range
185 185
 
186 186
 			$buffer[$offset]       = chr(0xff & ($assembledTwoBytes >> 8));
187
-			$buffer[($offset + 1)] = chr(0xff & $assembledTwoBytes);
188
-			$offset                += 2;
187
+			$buffer[($offset + 1)] = chr(0xff&$assembledTwoBytes);
188
+			$offset += 2;
189 189
 			$length--;
190 190
 		}
191 191
 
Please login to merge, or discard this patch.
src/Data/QRMatrix.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -26,43 +26,43 @@  discard block
 block discarded – undo
26 26
 	/** @var int */
27 27
 	public const M_NULL           = 0b000000000000;
28 28
 	/** @var int */
29
-	public const M_DARKMODULE     = (0b000000000001 | self::IS_DARK);
29
+	public const M_DARKMODULE     = (0b000000000001|self::IS_DARK);
30 30
 	/** @var int */
31 31
 	public const M_DATA           = 0b000000000010;
32 32
 	/** @var int */
33
-	public const M_DATA_DARK      = (self::M_DATA | self::IS_DARK);
33
+	public const M_DATA_DARK      = (self::M_DATA|self::IS_DARK);
34 34
 	/** @var int */
35 35
 	public const M_FINDER         = 0b000000000100;
36 36
 	/** @var int */
37
-	public const M_FINDER_DARK    = (self::M_FINDER | self::IS_DARK);
37
+	public const M_FINDER_DARK    = (self::M_FINDER|self::IS_DARK);
38 38
 	/** @var int */
39 39
 	public const M_SEPARATOR      = 0b000000001000;
40 40
 	/** @var int */
41 41
 	public const M_ALIGNMENT      = 0b000000010000;
42 42
 	/** @var int */
43
-	public const M_ALIGNMENT_DARK = (self::M_ALIGNMENT | self::IS_DARK);
43
+	public const M_ALIGNMENT_DARK = (self::M_ALIGNMENT|self::IS_DARK);
44 44
 	/** @var int */
45 45
 	public const M_TIMING         = 0b000000100000;
46 46
 	/** @var int */
47
-	public const M_TIMING_DARK    = (self::M_TIMING | self::IS_DARK);
47
+	public const M_TIMING_DARK    = (self::M_TIMING|self::IS_DARK);
48 48
 	/** @var int */
49 49
 	public const M_FORMAT         = 0b000001000000;
50 50
 	/** @var int */
51
-	public const M_FORMAT_DARK    = (self::M_FORMAT | self::IS_DARK);
51
+	public const M_FORMAT_DARK    = (self::M_FORMAT|self::IS_DARK);
52 52
 	/** @var int */
53 53
 	public const M_VERSION        = 0b000010000000;
54 54
 	/** @var int */
55
-	public const M_VERSION_DARK   = (self::M_VERSION | self::IS_DARK);
55
+	public const M_VERSION_DARK   = (self::M_VERSION|self::IS_DARK);
56 56
 	/** @var int */
57 57
 	public const M_QUIETZONE      = 0b000100000000;
58 58
 	/** @var int */
59 59
 	public const M_LOGO           = 0b001000000000;
60 60
 	/** @var int */
61
-	public const M_FINDER_DOT     = (0b010000000000 | self::IS_DARK);
61
+	public const M_FINDER_DOT     = (0b010000000000|self::IS_DARK);
62 62
 	/** @var int */
63 63
 	public const M_TEST           = 0b011111111111;
64 64
 	/** @var int */
65
-	public const M_TEST_DARK      = (self::M_TEST | self::IS_DARK);
65
+	public const M_TEST_DARK      = (self::M_TEST|self::IS_DARK);
66 66
 
67 67
 	/**
68 68
 	 * Map of flag => coord
@@ -73,13 +73,13 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	protected const neighbours = [
75 75
 		0b00000001 => [-1, -1],
76
-		0b00000010 => [ 0, -1],
77
-		0b00000100 => [ 1, -1],
78
-		0b00001000 => [ 1,  0],
79
-		0b00010000 => [ 1,  1],
80
-		0b00100000 => [ 0,  1],
81
-		0b01000000 => [-1,  1],
82
-		0b10000000 => [-1,  0],
76
+		0b00000010 => [0, -1],
77
+		0b00000100 => [1, -1],
78
+		0b00001000 => [1, 0],
79
+		0b00010000 => [1, 1],
80
+		0b00100000 => [0, 1],
81
+		0b01000000 => [-1, 1],
82
+		0b10000000 => [-1, 0],
83 83
 	];
84 84
 
85 85
 	/**
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 			$matrix[$y] = [];
160 160
 
161 161
 			foreach($row as $x => $val){
162
-				$matrix[$y][$x] = ($val & $this::IS_DARK) === $this::IS_DARK;
162
+				$matrix[$y][$x] = ($val&$this::IS_DARK) === $this::IS_DARK;
163 163
 			}
164 164
 		}
165 165
 
@@ -169,21 +169,21 @@  discard block
 block discarded – undo
169 169
 	/**
170 170
 	 * Returns the current version number
171 171
 	 */
172
-	public function version():?Version{
172
+	public function version(): ?Version{
173 173
 		return $this->version;
174 174
 	}
175 175
 
176 176
 	/**
177 177
 	 * Returns the current ECC level
178 178
 	 */
179
-	public function eccLevel():?EccLevel{
179
+	public function eccLevel(): ?EccLevel{
180 180
 		return $this->eccLevel;
181 181
 	}
182 182
 
183 183
 	/**
184 184
 	 * Returns the current mask pattern
185 185
 	 */
186
-	public function maskPattern():?MaskPattern{
186
+	public function maskPattern(): ?MaskPattern{
187 187
 		return $this->maskPattern;
188 188
 	}
189 189
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	public function set(int $x, int $y, bool $value, int $M_TYPE):self{
218 218
 
219 219
 		if(isset($this->matrix[$y][$x])){
220
-			$this->matrix[$y][$x] = (($M_TYPE & ~$this::IS_DARK) | (($value) ? $this::IS_DARK : 0));
220
+			$this->matrix[$y][$x] = (($M_TYPE & ~$this::IS_DARK)|(($value) ? $this::IS_DARK : 0));
221 221
 		}
222 222
 
223 223
 		return $this;
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 			return false;
247 247
 		}
248 248
 
249
-		return ($this->matrix[$y][$x] & $M_TYPE) === $M_TYPE;
249
+		return ($this->matrix[$y][$x]&$M_TYPE) === $M_TYPE;
250 250
 	}
251 251
 
252 252
 	/**
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			// check if the field is the same type
291 291
 			if(
292 292
 				$M_TYPE_VALUE !== null
293
-				&& ($this->get(($x + $ix), ($y + $iy)) | $this::IS_DARK) !== ($M_TYPE_VALUE | $this::IS_DARK)
293
+				&& ($this->get(($x + $ix), ($y + $iy))|$this::IS_DARK) !== ($M_TYPE_VALUE|$this::IS_DARK)
294 294
 			){
295 295
 				continue;
296 296
 			}
@@ -370,8 +370,8 @@  discard block
 block discarded – undo
370 370
 
371 371
 		for($c = 0; $c < 3; $c++){
372 372
 			for($i = 0; $i < 8; $i++){
373
-				$this->set($h[$c][0]     , ($h[$c][1] + $i), false, $this::M_SEPARATOR);
374
-				$this->set(($v[$c][0] - $i), $v[$c][1]     , false, $this::M_SEPARATOR);
373
+				$this->set($h[$c][0], ($h[$c][1] + $i), false, $this::M_SEPARATOR);
374
+				$this->set(($v[$c][0] - $i), $v[$c][1], false, $this::M_SEPARATOR);
375 375
 			}
376 376
 		}
377 377
 
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 		for($y = 0; $y < $this->moduleCount; $y++){
596 596
 			for($x = 0; $x < $this->moduleCount; $x++){
597 597
 				// out of bounds, skip
598
-				if($x < $start || $y < $start ||$x >= $end || $y >= $end){
598
+				if($x < $start || $y < $start || $x >= $end || $y >= $end){
599 599
 					continue;
600 600
 				}
601 601
 				// a match
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 
664 664
 		foreach($this->matrix as $y => $row){
665 665
 			foreach($row as $x => $val){
666
-				if($mask($x, $y) && ($val & $this::M_DATA) === $this::M_DATA){
666
+				if($mask($x, $y) && ($val&$this::M_DATA) === $this::M_DATA){
667 667
 					$this->flip($x, $y);
668 668
 				}
669 669
 			}
Please login to merge, or discard this patch.
src/Data/ECI.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
 			$bitBuffer->put($this->encoding, 8);
74 74
 		}
75 75
 		elseif($this->encoding < 16384){
76
-			$bitBuffer->put(($this->encoding | 0x8000), 16);
76
+			$bitBuffer->put(($this->encoding|0x8000), 16);
77 77
 		}
78 78
 		elseif($this->encoding < 1000000){
79
-			$bitBuffer->put(($this->encoding | 0xC00000), 24);
79
+			$bitBuffer->put(($this->encoding|0xC00000), 24);
80 80
 		}
81 81
 
82 82
 		return $this;
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
 		}
97 97
 		// two bytes
98 98
 		elseif(($firstByte & 0b11000000) === 0b10000000){
99
-			$id = ((($firstByte & 0b00111111) << 8) | $bitBuffer->read(8));
99
+			$id = ((($firstByte & 0b00111111) << 8)|$bitBuffer->read(8));
100 100
 		}
101 101
 		// three bytes
102 102
 		elseif(($firstByte & 0b11100000) === 0b11000000){
103
-			$id = ((($firstByte & 0b00011111) << 16) | $bitBuffer->read(16));
103
+			$id = ((($firstByte & 0b00011111) << 16)|$bitBuffer->read(16));
104 104
 		}
105 105
 		else{
106 106
 			throw new QRCodeDataException(sprintf('error decoding ECI value first byte: %08b', $firstByte)); // @codeCoverageIgnore
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
@@ -19,16 +19,16 @@  discard block
 block discarded – undo
19 19
  */
20 20
 final class ECICharset{
21 21
 
22
-	public const CP437                 = 0;  // Code page 437, DOS Latin US
23
-	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
24
-	public const CP437_WO_GLI          = 2;  // An equivalent code table to CP437, without the return-to-GLI 0 logic
25
-	public const ISO_IEC_8859_1        = 3;  // Latin-1 (Default)
26
-	public const ISO_IEC_8859_2        = 4;  // Latin-2
27
-	public const ISO_IEC_8859_3        = 5;  // Latin-3
28
-	public const ISO_IEC_8859_4        = 6;  // Latin-4
29
-	public const ISO_IEC_8859_5        = 7;  // Latin/Cyrillic
30
-	public const ISO_IEC_8859_6        = 8;  // Latin/Arabic
31
-	public const ISO_IEC_8859_7        = 9;  // Latin/Greek
22
+	public const CP437                 = 0; // Code page 437, DOS Latin US
23
+	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
24
+	public const CP437_WO_GLI          = 2; // An equivalent code table to CP437, without the return-to-GLI 0 logic
25
+	public const ISO_IEC_8859_1        = 3; // Latin-1 (Default)
26
+	public const ISO_IEC_8859_2        = 4; // Latin-2
27
+	public const ISO_IEC_8859_3        = 5; // Latin-3
28
+	public const ISO_IEC_8859_4        = 6; // Latin-4
29
+	public const ISO_IEC_8859_5        = 7; // Latin/Cyrillic
30
+	public const ISO_IEC_8859_6        = 8; // Latin/Arabic
31
+	public const ISO_IEC_8859_7        = 9; // Latin/Greek
32 32
 	public const ISO_IEC_8859_8        = 10; // Latin/Hebrew
33 33
 	public const ISO_IEC_8859_9        = 11; // Latin-5
34 34
 	public const ISO_IEC_8859_10       = 12; // Latin-6
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 * @see \mb_convert_encoding()
119 119
 	 * @see \iconv()
120 120
 	 */
121
-	public function getName():?string{
121
+	public function getName(): ?string{
122 122
 		return (self::MB_ENCODINGS[$this->charsetID] ?? null);
123 123
 	}
124 124
 
Please login to merge, or discard this patch.