Passed
Push — main ( 7e756a...51d7c2 )
by smiley
02:02
created
src/Common/GF256.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 
39 39
 	private const logTable = [
40 40
 		  0, // the first value is never returned, index starts at 1
41
-		       0,   1,  25,   2,  50,  26, 198,   3, 223,  51, 238,  27, 104, 199,  75,
41
+			   0,   1,  25,   2,  50,  26, 198,   3, 223,  51, 238,  27, 104, 199,  75,
42 42
 		  4, 100, 224,  14,  52, 141, 239, 129,  28, 193, 105, 248, 200,   8,  76, 113,
43 43
 		  5, 138, 101,  47, 225,  36,  15,  33,  53, 147, 142, 218, 240,  18, 130,  69,
44 44
 		 29, 181, 194, 125, 106,  39, 249, 185, 201, 154,   9, 120,  77, 228, 114, 166,
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -36,41 +36,41 @@  discard block
 block discarded – undo
36 36
 
37 37
 	private const logTable = [
38 38
 		  0, // the first value is never returned, index starts at 1
39
-		       0,   1,  25,   2,  50,  26, 198,   3, 223,  51, 238,  27, 104, 199,  75,
40
-		  4, 100, 224,  14,  52, 141, 239, 129,  28, 193, 105, 248, 200,   8,  76, 113,
41
-		  5, 138, 101,  47, 225,  36,  15,  33,  53, 147, 142, 218, 240,  18, 130,  69,
42
-		 29, 181, 194, 125, 106,  39, 249, 185, 201, 154,   9, 120,  77, 228, 114, 166,
43
-		  6, 191, 139,  98, 102, 221,  48, 253, 226, 152,  37, 179,  16, 145,  34, 136,
44
-		 54, 208, 148, 206, 143, 150, 219, 189, 241, 210,  19,  92, 131,  56,  70,  64,
45
-		 30,  66, 182, 163, 195,  72, 126, 110, 107,  58,  40,  84, 250, 133, 186,  61,
46
-		202,  94, 155, 159,  10,  21, 121,  43,  78, 212, 229, 172, 115, 243, 167,  87,
47
-		  7, 112, 192, 247, 140, 128,  99,  13, 103,  74, 222, 237,  49, 197, 254,  24,
48
-		227, 165, 153, 119,  38, 184, 180, 124,  17,  68, 146, 217,  35,  32, 137,  46,
49
-		 55,  63, 209,  91, 149, 188, 207, 205, 144, 135, 151, 178, 220, 252, 190,  97,
50
-		242,  86, 211, 171,  20,  42,  93, 158, 132,  60,  57,  83,  71, 109,  65, 162,
51
-		 31,  45,  67, 216, 183, 123, 164, 118, 196,  23,  73, 236, 127,  12, 111, 246,
52
-		108, 161,  59,  82,  41, 157,  85, 170, 251,  96, 134, 177, 187, 204,  62,  90,
53
-		203,  89,  95, 176, 156, 169, 160,  81,  11, 245,  22, 235, 122, 117,  44, 215,
54
-		 79, 174, 213, 233, 230, 231, 173, 232, 116, 214, 244, 234, 168,  80,  88, 175,
39
+		       0, 1, 25, 2, 50, 26, 198, 3, 223, 51, 238, 27, 104, 199, 75,
40
+		  4, 100, 224, 14, 52, 141, 239, 129, 28, 193, 105, 248, 200, 8, 76, 113,
41
+		  5, 138, 101, 47, 225, 36, 15, 33, 53, 147, 142, 218, 240, 18, 130, 69,
42
+		 29, 181, 194, 125, 106, 39, 249, 185, 201, 154, 9, 120, 77, 228, 114, 166,
43
+		  6, 191, 139, 98, 102, 221, 48, 253, 226, 152, 37, 179, 16, 145, 34, 136,
44
+		 54, 208, 148, 206, 143, 150, 219, 189, 241, 210, 19, 92, 131, 56, 70, 64,
45
+		 30, 66, 182, 163, 195, 72, 126, 110, 107, 58, 40, 84, 250, 133, 186, 61,
46
+		202, 94, 155, 159, 10, 21, 121, 43, 78, 212, 229, 172, 115, 243, 167, 87,
47
+		  7, 112, 192, 247, 140, 128, 99, 13, 103, 74, 222, 237, 49, 197, 254, 24,
48
+		227, 165, 153, 119, 38, 184, 180, 124, 17, 68, 146, 217, 35, 32, 137, 46,
49
+		 55, 63, 209, 91, 149, 188, 207, 205, 144, 135, 151, 178, 220, 252, 190, 97,
50
+		242, 86, 211, 171, 20, 42, 93, 158, 132, 60, 57, 83, 71, 109, 65, 162,
51
+		 31, 45, 67, 216, 183, 123, 164, 118, 196, 23, 73, 236, 127, 12, 111, 246,
52
+		108, 161, 59, 82, 41, 157, 85, 170, 251, 96, 134, 177, 187, 204, 62, 90,
53
+		203, 89, 95, 176, 156, 169, 160, 81, 11, 245, 22, 235, 122, 117, 44, 215,
54
+		 79, 174, 213, 233, 230, 231, 173, 232, 116, 214, 244, 234, 168, 80, 88, 175,
55 55
 	];
56 56
 
57 57
 	private const expTable = [
58
-		  1,   2,   4,   8,  16,  32,  64, 128,  29,  58, 116, 232, 205, 135,  19,  38,
59
-		 76, 152,  45,  90, 180, 117, 234, 201, 143,   3,   6,  12,  24,  48,  96, 192,
60
-		157,  39,  78, 156,  37,  74, 148,  53, 106, 212, 181, 119, 238, 193, 159,  35,
61
-		 70, 140,   5,  10,  20,  40,  80, 160,  93, 186, 105, 210, 185, 111, 222, 161,
62
-		 95, 190,  97, 194, 153,  47,  94, 188, 101, 202, 137,  15,  30,  60, 120, 240,
63
-		253, 231, 211, 187, 107, 214, 177, 127, 254, 225, 223, 163,  91, 182, 113, 226,
64
-		217, 175,  67, 134,  17,  34,  68, 136,  13,  26,  52, 104, 208, 189, 103, 206,
65
-		129,  31,  62, 124, 248, 237, 199, 147,  59, 118, 236, 197, 151,  51, 102, 204,
66
-		133,  23,  46,  92, 184, 109, 218, 169,  79, 158,  33,  66, 132,  21,  42,  84,
67
-		168,  77, 154,  41,  82, 164,  85, 170,  73, 146,  57, 114, 228, 213, 183, 115,
68
-		230, 209, 191,  99, 198, 145,  63, 126, 252, 229, 215, 179, 123, 246, 241, 255,
69
-		227, 219, 171,  75, 150,  49,  98, 196, 149,  55, 110, 220, 165,  87, 174,  65,
70
-		130,  25,  50, 100, 200, 141,   7,  14,  28,  56, 112, 224, 221, 167,  83, 166,
71
-		 81, 162,  89, 178, 121, 242, 249, 239, 195, 155,  43,  86, 172,  69, 138,   9,
72
-		 18,  36,  72, 144,  61, 122, 244, 245, 247, 243, 251, 235, 203, 139,  11,  22,
73
-		 44,  88, 176, 125, 250, 233, 207, 131,  27,  54, 108, 216, 173,  71, 142,   1,
58
+		  1, 2, 4, 8, 16, 32, 64, 128, 29, 58, 116, 232, 205, 135, 19, 38,
59
+		 76, 152, 45, 90, 180, 117, 234, 201, 143, 3, 6, 12, 24, 48, 96, 192,
60
+		157, 39, 78, 156, 37, 74, 148, 53, 106, 212, 181, 119, 238, 193, 159, 35,
61
+		 70, 140, 5, 10, 20, 40, 80, 160, 93, 186, 105, 210, 185, 111, 222, 161,
62
+		 95, 190, 97, 194, 153, 47, 94, 188, 101, 202, 137, 15, 30, 60, 120, 240,
63
+		253, 231, 211, 187, 107, 214, 177, 127, 254, 225, 223, 163, 91, 182, 113, 226,
64
+		217, 175, 67, 134, 17, 34, 68, 136, 13, 26, 52, 104, 208, 189, 103, 206,
65
+		129, 31, 62, 124, 248, 237, 199, 147, 59, 118, 236, 197, 151, 51, 102, 204,
66
+		133, 23, 46, 92, 184, 109, 218, 169, 79, 158, 33, 66, 132, 21, 42, 84,
67
+		168, 77, 154, 41, 82, 164, 85, 170, 73, 146, 57, 114, 228, 213, 183, 115,
68
+		230, 209, 191, 99, 198, 145, 63, 126, 252, 229, 215, 179, 123, 246, 241, 255,
69
+		227, 219, 171, 75, 150, 49, 98, 196, 149, 55, 110, 220, 165, 87, 174, 65,
70
+		130, 25, 50, 100, 200, 141, 7, 14, 28, 56, 112, 224, 221, 167, 83, 166,
71
+		 81, 162, 89, 178, 121, 242, 249, 239, 195, 155, 43, 86, 172, 69, 138, 9,
72
+		 18, 36, 72, 144, 61, 122, 244, 245, 247, 243, 251, 235, 203, 139, 11, 22,
73
+		 44, 88, 176, 125, 250, 233, 207, 131, 27, 54, 108, 216, 173, 71, 142, 1,
74 74
 	];
75 75
 
76 76
 	/**
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * @return int sum/difference of a and b
80 80
 	 */
81 81
 	public static function addOrSubtract(int $a, int $b):int{
82
-		return ($a ^ $b);
82
+		return ($a^$b);
83 83
 	}
84 84
 
85 85
 	/**
Please login to merge, or discard this patch.
src/Common/ReedSolomonDecoder.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,8 @@
 block discarded – undo
143 143
 		// This is a direct application of Chien's search
144 144
 		$numErrors = $errorLocator->getDegree();
145 145
 
146
-		if($numErrors === 1){ // shortcut
146
+		if($numErrors === 1){
147
+// shortcut
147 148
 			return [$errorLocator->getCoefficient(1)];
148 149
 		}
149 150
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		[$numEccCodewords, $eccBlocks] = $this->version->getRSBlocks($this->eccLevel);
79 79
 
80 80
 		// Now establish DataBlocks of the appropriate size and number of data codewords
81
-		$result          = [];//new DataBlock[$totalBlocks];
81
+		$result          = []; //new DataBlock[$totalBlocks];
82 82
 		$numResultBlocks = 0;
83 83
 
84 84
 		foreach($eccBlocks as $blockData){
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 					// Above should work but fails on some Apple and Linux JDKs due to a Hotspot bug.
305 305
 					// Below is a funny-looking workaround from Steven Parkes
306 306
 					$term        = GF256::multiply($errorLocations[$j], $xiInverse);
307
-					$denominator = GF256::multiply($denominator, ((($term & 0x1) === 0) ? ($term | 1) : ($term & ~1)));
307
+					$denominator = GF256::multiply($denominator, ((($term & 0x1) === 0) ? ($term|1) : ($term & ~1)));
308 308
 				}
309 309
 			}
310 310
 
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   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	 * @return float|null vertical center of finder pattern, or null if not found
331 331
 	 * @noinspection DuplicatedCode
332 332
 	 */
333
-	private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal):?float{
333
+	private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal): ?float{
334 334
 		$maxI       = $this->matrix->size();
335 335
 		$stateCount = $this->getCrossCheckStateCount();
336 336
 
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 	 * check a vertical cross-check and locate the real center of the alignment pattern.
415 415
 	 * @noinspection DuplicatedCode
416 416
 	 */
417
-	private function crossCheckHorizontal(int $startJ, int $centerI, int $maxCount, int $originalStateCountTotal):?float{
417
+	private function crossCheckHorizontal(int $startJ, int $centerI, int $maxCount, int $originalStateCountTotal): ?float{
418 418
 		$maxJ       = $this->matrix->size();
419 419
 		$stateCount = $this->getCrossCheckStateCount();
420 420
 
Please login to merge, or discard this patch.
src/Detector/Detector.php 2 patches
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.
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/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
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 * @see \mb_convert_encoding()
118 118
 	 * @see \iconv()
119 119
 	 */
120
-	public function getName():?string{
120
+	public function getName(): ?string{
121 121
 		return self::MB_ENCODINGS[$this->charsetID];
122 122
 	}
123 123
 
Please login to merge, or discard this patch.
src/Decoder/GDLuminanceSource.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
 	protected function setLuminancePixels():void{
61 61
 
62 62
 		if($this->options->readerGrayscale){
63
-			imagefilter($this->gdImage,  IMG_FILTER_GRAYSCALE);
63
+			imagefilter($this->gdImage, IMG_FILTER_GRAYSCALE);
64 64
 		}
65 65
 
66 66
 		if($this->options->readerIncreaseContrast){
Please login to merge, or discard this patch.
src/Data/ECI.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,12 +67,12 @@
 block discarded – undo
67 67
 
68 68
 		if(($firstByte & 0xc0) === 0x80){
69 69
 			// two bytes
70
-			return new ECICharset((($firstByte & 0x3f) << 8) | $bitBuffer->read(8));
70
+			return new ECICharset((($firstByte & 0x3f) << 8)|$bitBuffer->read(8));
71 71
 		}
72 72
 
73 73
 		if(($firstByte & 0xe0) === 0xC0){
74 74
 			// three bytes
75
-			return new ECICharset((($firstByte & 0x1f) << 16) | $bitBuffer->read(16));
75
+			return new ECICharset((($firstByte & 0x1f) << 16)|$bitBuffer->read(16));
76 76
 		}
77 77
 
78 78
 		throw new QRCodeDataException('error decoding ECI value');
Please login to merge, or discard this patch.
src/Detector/GridSampler.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -153,7 +153,8 @@
 block discarded – undo
153 153
 				}
154 154
 			}
155 155
 			// @codeCoverageIgnoreStart
156
-			catch(Throwable $aioobe){//ArrayIndexOutOfBoundsException
156
+			catch(Throwable $aioobe){
157
+//ArrayIndexOutOfBoundsException
157 158
 				// This feels wrong, but, sometimes if the finder patterns are misidentified, the resulting
158 159
 				// transform gets "twisted" such that it maps a straight line of points to a set of points
159 160
 				// whose endpoints are in bounds, but others are not. There is probably some mathematical
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
@@ -85,7 +85,8 @@
 block discarded – undo
85 85
 
86 86
 				if($this->matrix->check($j, $i)){
87 87
 					// Black pixel
88
-					if($currentState === 1){ // Counting black pixels
88
+					if($currentState === 1){
89
+// Counting black pixels
89 90
 						$stateCount[$currentState]++;
90 91
 					}
91 92
 					// Counting white pixels
Please login to merge, or discard this 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.