Passed
Push — main ( 284c42...6b9f6f )
by smiley
12:10
created
src/Common/EccLevel.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -37,46 +37,46 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	private const MAX_BITS = [
39 39
 	//	[    L,     M,     Q,     H]  // v  => modules
40
-		[    0,     0,     0,     0], // 0  =>  will be ignored, index starts at 1
41
-		[  152,   128,   104,    72], // 1  =>  21
42
-		[  272,   224,   176,   128], // 2  =>  25
43
-		[  440,   352,   272,   208], // 3  =>  29
44
-		[  640,   512,   384,   288], // 4  =>  33
45
-		[  864,   688,   496,   368], // 5  =>  37
46
-		[ 1088,   864,   608,   480], // 6  =>  41
47
-		[ 1248,   992,   704,   528], // 7  =>  45
48
-		[ 1552,  1232,   880,   688], // 8  =>  49
49
-		[ 1856,  1456,  1056,   800], // 9  =>  53
50
-		[ 2192,  1728,  1232,   976], // 10 =>  57
51
-		[ 2592,  2032,  1440,  1120], // 11 =>  61
52
-		[ 2960,  2320,  1648,  1264], // 12 =>  65
53
-		[ 3424,  2672,  1952,  1440], // 13 =>  69 NICE!
54
-		[ 3688,  2920,  2088,  1576], // 14 =>  73
55
-		[ 4184,  3320,  2360,  1784], // 15 =>  77
56
-		[ 4712,  3624,  2600,  2024], // 16 =>  81
57
-		[ 5176,  4056,  2936,  2264], // 17 =>  85
58
-		[ 5768,  4504,  3176,  2504], // 18 =>  89
59
-		[ 6360,  5016,  3560,  2728], // 19 =>  93
60
-		[ 6888,  5352,  3880,  3080], // 20 =>  97
61
-		[ 7456,  5712,  4096,  3248], // 21 => 101
62
-		[ 8048,  6256,  4544,  3536], // 22 => 105
63
-		[ 8752,  6880,  4912,  3712], // 23 => 109
64
-		[ 9392,  7312,  5312,  4112], // 24 => 113
65
-		[10208,  8000,  5744,  4304], // 25 => 117
66
-		[10960,  8496,  6032,  4768], // 26 => 121
67
-		[11744,  9024,  6464,  5024], // 27 => 125
68
-		[12248,  9544,  6968,  5288], // 28 => 129
69
-		[13048, 10136,  7288,  5608], // 29 => 133
70
-		[13880, 10984,  7880,  5960], // 30 => 137
71
-		[14744, 11640,  8264,  6344], // 31 => 141
72
-		[15640, 12328,  8920,  6760], // 32 => 145
73
-		[16568, 13048,  9368,  7208], // 33 => 149
74
-		[17528, 13800,  9848,  7688], // 34 => 153
75
-		[18448, 14496, 10288,  7888], // 35 => 157
76
-		[19472, 15312, 10832,  8432], // 36 => 161
77
-		[20528, 15936, 11408,  8768], // 37 => 165
78
-		[21616, 16816, 12016,  9136], // 38 => 169
79
-		[22496, 17728, 12656,  9776], // 39 => 173
40
+		[0, 0, 0, 0], // 0  =>  will be ignored, index starts at 1
41
+		[152, 128, 104, 72], // 1  =>  21
42
+		[272, 224, 176, 128], // 2  =>  25
43
+		[440, 352, 272, 208], // 3  =>  29
44
+		[640, 512, 384, 288], // 4  =>  33
45
+		[864, 688, 496, 368], // 5  =>  37
46
+		[1088, 864, 608, 480], // 6  =>  41
47
+		[1248, 992, 704, 528], // 7  =>  45
48
+		[1552, 1232, 880, 688], // 8  =>  49
49
+		[1856, 1456, 1056, 800], // 9  =>  53
50
+		[2192, 1728, 1232, 976], // 10 =>  57
51
+		[2592, 2032, 1440, 1120], // 11 =>  61
52
+		[2960, 2320, 1648, 1264], // 12 =>  65
53
+		[3424, 2672, 1952, 1440], // 13 =>  69 NICE!
54
+		[3688, 2920, 2088, 1576], // 14 =>  73
55
+		[4184, 3320, 2360, 1784], // 15 =>  77
56
+		[4712, 3624, 2600, 2024], // 16 =>  81
57
+		[5176, 4056, 2936, 2264], // 17 =>  85
58
+		[5768, 4504, 3176, 2504], // 18 =>  89
59
+		[6360, 5016, 3560, 2728], // 19 =>  93
60
+		[6888, 5352, 3880, 3080], // 20 =>  97
61
+		[7456, 5712, 4096, 3248], // 21 => 101
62
+		[8048, 6256, 4544, 3536], // 22 => 105
63
+		[8752, 6880, 4912, 3712], // 23 => 109
64
+		[9392, 7312, 5312, 4112], // 24 => 113
65
+		[10208, 8000, 5744, 4304], // 25 => 117
66
+		[10960, 8496, 6032, 4768], // 26 => 121
67
+		[11744, 9024, 6464, 5024], // 27 => 125
68
+		[12248, 9544, 6968, 5288], // 28 => 129
69
+		[13048, 10136, 7288, 5608], // 29 => 133
70
+		[13880, 10984, 7880, 5960], // 30 => 137
71
+		[14744, 11640, 8264, 6344], // 31 => 141
72
+		[15640, 12328, 8920, 6760], // 32 => 145
73
+		[16568, 13048, 9368, 7208], // 33 => 149
74
+		[17528, 13800, 9848, 7688], // 34 => 153
75
+		[18448, 14496, 10288, 7888], // 35 => 157
76
+		[19472, 15312, 10832, 8432], // 36 => 161
77
+		[20528, 15936, 11408, 8768], // 37 => 165
78
+		[21616, 16816, 12016, 9136], // 38 => 169
79
+		[22496, 17728, 12656, 9776], // 39 => 173
80 80
 		[23648, 18672, 13328, 10208], // 40 => 177
81 81
 	];
82 82
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 * @var int[][]
89 89
 	 */
90 90
 	private const FORMAT_PATTERN = [
91
-		[ // L
91
+		[// L
92 92
 		  0b111011111000100,
93 93
 		  0b111001011110011,
94 94
 		  0b111110110101010,
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 		  0b110110001000001,
99 99
 		  0b110100101110110,
100 100
 		],
101
-		[ // M
101
+		[// M
102 102
 		  0b101010000010010,
103 103
 		  0b101000100100101,
104 104
 		  0b101111001111100,
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 		  0b100111110010111,
109 109
 		  0b100101010100000,
110 110
 		],
111
-		[ // Q
111
+		[// Q
112 112
 		  0b011010101011111,
113 113
 		  0b011000001101000,
114 114
 		  0b011111100110001,
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		  0b010111011011010,
119 119
 		  0b010101111101101,
120 120
 		],
121
-		[ // H
121
+		[// H
122 122
 		  0b001011010001001,
123 123
 		  0b001001110111110,
124 124
 		  0b001110011100111,
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	 */
151 151
 	public function __construct(int $eccLevel){
152 152
 
153
-		if((0b11 & $eccLevel) !== $eccLevel){
153
+		if((0b11&$eccLevel) !== $eccLevel){
154 154
 			throw new QRCodeException('invalid ECC level');
155 155
 		}
156 156
 
Please login to merge, or discard this patch.
src/Data/QRMatrix.php 1 patch
Spacing   +30 added lines, -30 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
 	/**
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 			$matrix[$y] = [];
163 163
 
164 164
 			foreach($row as $x => $val){
165
-				$matrix[$y][$x] = ($val & $this::IS_DARK) === $this::IS_DARK;
165
+				$matrix[$y][$x] = ($val&$this::IS_DARK) === $this::IS_DARK;
166 166
 			}
167 167
 		}
168 168
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	/**
182 182
 	 * Returns the current version number
183 183
 	 */
184
-	public function getVersion():?Version{
184
+	public function getVersion(): ?Version{
185 185
 		return $this->version;
186 186
 	}
187 187
 
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 	 * @see \chillerlan\QRCode\Data\QRMatrix::getVersion()
191 191
 	 * @codeCoverageIgnore
192 192
 	 */
193
-	public function version():?Version{
193
+	public function version(): ?Version{
194 194
 		return $this->getVersion();
195 195
 	}
196 196
 
197 197
 	/**
198 198
 	 * Returns the current ECC level
199 199
 	 */
200
-	public function getEccLevel():?EccLevel{
200
+	public function getEccLevel(): ?EccLevel{
201 201
 		return $this->eccLevel;
202 202
 	}
203 203
 
@@ -206,14 +206,14 @@  discard block
 block discarded – undo
206 206
 	 * @see \chillerlan\QRCode\Data\QRMatrix::getEccLevel()
207 207
 	 * @codeCoverageIgnore
208 208
 	 */
209
-	public function eccLevel():?EccLevel{
209
+	public function eccLevel(): ?EccLevel{
210 210
 		return $this->getEccLevel();
211 211
 	}
212 212
 
213 213
 	/**
214 214
 	 * Returns the current mask pattern
215 215
 	 */
216
-	public function getMaskPattern():?MaskPattern{
216
+	public function getMaskPattern(): ?MaskPattern{
217 217
 		return $this->maskPattern;
218 218
 	}
219 219
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 * @see \chillerlan\QRCode\Data\QRMatrix::getMaskPattern()
223 223
 	 * @codeCoverageIgnore
224 224
 	 */
225
-	public function maskPattern():?MaskPattern{
225
+	public function maskPattern(): ?MaskPattern{
226 226
 		return $this->getMaskPattern();
227 227
 	}
228 228
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	public function set(int $x, int $y, bool $value, int $M_TYPE):self{
266 266
 
267 267
 		if(isset($this->matrix[$y][$x])){
268
-			$this->matrix[$y][$x] = (($M_TYPE & ~$this::IS_DARK) | (($value) ? $this::IS_DARK : 0));
268
+			$this->matrix[$y][$x] = (($M_TYPE & ~$this::IS_DARK)|(($value) ? $this::IS_DARK : 0));
269 269
 		}
270 270
 
271 271
 		return $this;
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 			return false;
295 295
 		}
296 296
 
297
-		return ($this->matrix[$y][$x] & $M_TYPE) === $M_TYPE;
297
+		return ($this->matrix[$y][$x]&$M_TYPE) === $M_TYPE;
298 298
 	}
299 299
 
300 300
 	/**
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 			// check if the field is the same type
339 339
 			if(
340 340
 				$M_TYPE_VALUE !== null
341
-				&& ($this->get(($x + $ix), ($y + $iy)) | $this::IS_DARK) !== ($M_TYPE_VALUE | $this::IS_DARK)
341
+				&& ($this->get(($x + $ix), ($y + $iy))|$this::IS_DARK) !== ($M_TYPE_VALUE|$this::IS_DARK)
342 342
 			){
343 343
 				continue;
344 344
 			}
@@ -418,8 +418,8 @@  discard block
 block discarded – undo
418 418
 
419 419
 		for($c = 0; $c < 3; $c++){
420 420
 			for($i = 0; $i < 8; $i++){
421
-				$this->set($h[$c][0]     , ($h[$c][1] + $i), false, $this::M_SEPARATOR);
422
-				$this->set(($v[$c][0] - $i), $v[$c][1]     , false, $this::M_SEPARATOR);
421
+				$this->set($h[$c][0], ($h[$c][1] + $i), false, $this::M_SEPARATOR);
422
+				$this->set(($v[$c][0] - $i), $v[$c][1], false, $this::M_SEPARATOR);
423 423
 			}
424 424
 		}
425 425
 
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 		for($y = 0; $y < $this->moduleCount; $y++){
648 648
 			for($x = 0; $x < $this->moduleCount; $x++){
649 649
 				// out of bounds, skip
650
-				if($x < $start || $y < $start ||$x >= $end || $y >= $end){
650
+				if($x < $start || $y < $start || $x >= $end || $y >= $end){
651 651
 					continue;
652 652
 				}
653 653
 				// a match
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 
717 717
 		foreach($this->matrix as $y => $row){
718 718
 			foreach($row as $x => $val){
719
-				if($mask($x, $y) && ($val & $this::M_DATA) === $this::M_DATA){
719
+				if($mask($x, $y) && ($val&$this::M_DATA) === $this::M_DATA){
720 720
 					$this->flip($x, $y);
721 721
 				}
722 722
 			}
Please login to merge, or discard this patch.