Passed
Push — master ( bb3c8a...bc2f97 )
by smiley
03:00
created
src/QRCode.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -45,29 +45,29 @@  discard block
 block discarded – undo
45 45
 	const ERROR_CORRECT_LEVEL_H = 2; // 30%.
46 46
 
47 47
 	// max bits @ ec level L:07 M:15 Q:25 H:30 %
48
-	const TYPE_01 =  1; //  152  128  104   72
49
-	const TYPE_02 =  2; //  272  224  176  128
50
-	const TYPE_03 =  3; //  440  352  272  208
51
-	const TYPE_04 =  4; //  640  512  384  288
52
-	const TYPE_05 =  5; //  864  688  496  368
53
-	const TYPE_06 =  6; // 1088  864  608  480
54
-	const TYPE_07 =  7; // 1248  992  704  528
55
-	const TYPE_08 =  8; // 1552 1232  880  688
56
-	const TYPE_09 =  9; // 1856 1456 1056  800
48
+	const TYPE_01 = 1; //  152  128  104   72
49
+	const TYPE_02 = 2; //  272  224  176  128
50
+	const TYPE_03 = 3; //  440  352  272  208
51
+	const TYPE_04 = 4; //  640  512  384  288
52
+	const TYPE_05 = 5; //  864  688  496  368
53
+	const TYPE_06 = 6; // 1088  864  608  480
54
+	const TYPE_07 = 7; // 1248  992  704  528
55
+	const TYPE_08 = 8; // 1552 1232  880  688
56
+	const TYPE_09 = 9; // 1856 1456 1056  800
57 57
 	const TYPE_10 = 10; // 2192 1728 1232  976
58 58
 
59 59
 
60 60
 	const MAX_BITS = [
61
-		self::TYPE_01 => [ 128,  152,   72,  104],
62
-		self::TYPE_02 => [ 224,  272,  128,  176],
63
-		self::TYPE_03 => [ 352,  440,  208,  272],
64
-		self::TYPE_04 => [ 512,  640,  288,  384],
65
-		self::TYPE_05 => [ 688,  864,  368,  496],
66
-		self::TYPE_06 => [ 864, 1088,  480,  608],
67
-		self::TYPE_07 => [ 992, 1248,  528,  704],
68
-		self::TYPE_08 => [1232, 1552,  688,  880],
69
-		self::TYPE_09 => [1456, 1856,  800, 1056],
70
-		self::TYPE_10 => [1728, 2192,  976, 1232],
61
+		self::TYPE_01 => [128, 152, 72, 104],
62
+		self::TYPE_02 => [224, 272, 128, 176],
63
+		self::TYPE_03 => [352, 440, 208, 272],
64
+		self::TYPE_04 => [512, 640, 288, 384],
65
+		self::TYPE_05 => [688, 864, 368, 496],
66
+		self::TYPE_06 => [864, 1088, 480, 608],
67
+		self::TYPE_07 => [992, 1248, 528, 704],
68
+		self::TYPE_08 => [1232, 1552, 688, 880],
69
+		self::TYPE_09 => [1456, 1856, 800, 1056],
70
+		self::TYPE_10 => [1728, 2192, 976, 1232],
71 71
 	];
72 72
 
73 73
 	const RSBLOCK = [
@@ -337,9 +337,9 @@  discard block
 block discarded – undo
337 337
 				$count = 0;
338 338
 
339 339
 				if(
340
-					   $this->matrix[$row    ][$col    ]
341
-					|| $this->matrix[$row    ][$col + 1]
342
-					|| $this->matrix[$row + 1][$col    ]
340
+					   $this->matrix[$row][$col]
341
+					|| $this->matrix[$row][$col + 1]
342
+					|| $this->matrix[$row + 1][$col]
343 343
 					|| $this->matrix[$row + 1][$col + 1]
344 344
 				){
345 345
 					$count++;
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 			foreach($range2 as $col){
367 367
 
368 368
 				if(
369
-					    $this->matrix[$row][$col    ]
369
+					    $this->matrix[$row][$col]
370 370
 					&& !$this->matrix[$row][$col + 1]
371 371
 					&&  $this->matrix[$row][$col + 2]
372 372
 					&&  $this->matrix[$row][$col + 3]
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 			foreach($range2 as $row){
385 385
 
386 386
 				if(
387
-					    $this->matrix[$row    ][$col]
387
+					    $this->matrix[$row][$col]
388 388
 					&& !$this->matrix[$row + 1][$col]
389 389
 					&&  $this->matrix[$row + 2][$col]
390 390
 					&&  $this->matrix[$row + 3][$col]
@@ -427,11 +427,11 @@  discard block
 block discarded – undo
427 427
 		$this->lostPoint = 0;
428 428
 		$this->darkCount = 0;
429 429
 
430
-		$range = range(0, $this->pixelCount-1);
430
+		$range = range(0, $this->pixelCount - 1);
431 431
 
432 432
 		$this->testLevel1($range);
433
-		$this->testLevel2(range(0, $this->pixelCount-2));
434
-		$this->testLevel3($range, range(0, $this->pixelCount-7));
433
+		$this->testLevel2(range(0, $this->pixelCount - 2));
434
+		$this->testLevel3($range, range(0, $this->pixelCount - 7));
435 435
 		$this->testLevel4($range);
436 436
 
437 437
 		$this->lostPoint += (abs(100 * $this->darkCount / $this->pixelCount / $this->pixelCount - 50) / 5) * 10;
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 			$a = (int)floor($i / 3);
456 456
 			$b = $i % 3 + $this->pixelCount - 8 - 3;
457 457
 
458
-			$this->matrix[$a][$b] = $this->matrix[$b][$a] = !$test && (($bits >> $i) & 1) === 1;
458
+			$this->matrix[$a][$b] = $this->matrix[$b][$a] = !$test && (($bits >> $i)&1) === 1;
459 459
 		}
460 460
 
461 461
 	}
@@ -468,13 +468,13 @@  discard block
 block discarded – undo
468 468
 	 */
469 469
 	protected function setTypeInfo(bool $test, int $pattern){
470 470
 		$this->setPattern();
471
-		$bits = Util::getBCHTypeInfo(($this->errorCorrectLevel << 3) | $pattern);
471
+		$bits = Util::getBCHTypeInfo(($this->errorCorrectLevel << 3)|$pattern);
472 472
 
473 473
 		for($i = 0; $i < 15; $i++){
474
-			$mod = !$test && (($bits >> $i) & 1) === 1;
474
+			$mod = !$test && (($bits >> $i)&1) === 1;
475 475
 
476 476
 			switch(true){
477
-				case $i < 6: $this->matrix[$i    ][8] = $mod; break;
477
+				case $i < 6: $this->matrix[$i][8] = $mod; break;
478 478
 				case $i < 8: $this->matrix[$i + 1][8] = $mod; break;
479 479
 				default:
480 480
 					$this->matrix[$this->pixelCount - 15 + $i][8] = $mod;
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 
483 483
 			switch(true){
484 484
 				case $i < 8: $this->matrix[8][$this->pixelCount - $i - 1] = $mod; break;
485
-				case $i < 9: $this->matrix[8][           15 + 1 - $i - 1] = $mod; break;
485
+				case $i < 9: $this->matrix[8][15 + 1 - $i - 1] = $mod; break;
486 486
 				default:
487 487
 					$this->matrix[8][15 - $i - 1] = $mod;
488 488
 			}
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 
566 566
 			foreach($dcdata[$key] as $i => &$_dcdata){
567 567
 				$bdata = $this->bitBuffer->buffer;
568
-				$_dcdata = 0xff & $bdata[$i + $offset];
568
+				$_dcdata = 0xff&$bdata[$i + $offset];
569 569
 			}
570 570
 
571 571
 			$offset += $rsBlockDataCount;
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 						$dark = false;
642 642
 
643 643
 						if($byteIndex < $dataCount){
644
-							$dark = (($data[$byteIndex] >> $bitIndex) & 1) === 1;
644
+							$dark = (($data[$byteIndex] >> $bitIndex)&1) === 1;
645 645
 						}
646 646
 
647 647
 						$a = $row + $_col;
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 					$this->matrix[$row + $r][$col + $c] =
703 703
 						(0 <= $r && $r <= 6 && ($c === 0 || $c === 6))
704 704
 						|| (0 <= $c && $c <= 6 && ($r === 0 || $r === 6))
705
-						|| (2 <= $c && $c <= 4 &&  2 <= $r && $r <= 4);
705
+						|| (2 <= $c && $c <= 4 && 2 <= $r && $r <= 4);
706 706
 				}
707 707
 			}
708 708
 		}
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 						$this->matrix[$posI + $row][$posJ + $col] =
727 727
 							    $row === -2 || $row === 2
728 728
 							||  $col === -2 || $col === 2
729
-							|| ($row ===  0 && $col === 0);
729
+							|| ($row === 0 && $col === 0);
730 730
 					}
731 731
 				}
732 732
 			}
Please login to merge, or discard this patch.
src/Util.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -20,16 +20,16 @@  discard block
 block discarded – undo
20 20
 class Util{
21 21
 
22 22
 	const MAX_LENGTH = [
23
-		[[ 41,  25,  17,  10], [ 34,  20,  14,   8], [ 27,  16,  11,   7], [ 17,  10,   7,   4]],
24
-		[[ 77,  47,  32,  20], [ 63,  38,  26,  16], [ 48,  29,  20,  12], [ 34,  20,  14,   8]],
25
-		[[127,  77,  53,  32], [101,  61,  42,  26], [ 77,  47,  32,  20], [ 58,  35,  24,  15]],
26
-		[[187, 114,  78,  48], [149,  90,  62,  38], [111,  67,  46,  28], [ 82,  50,  34,  21]],
27
-		[[255, 154, 106,  65], [202, 122,  84,  52], [144,  87,  60,  37], [106,  64,  44,  27]],
28
-		[[322, 195, 134,  82], [255, 154, 106,  65], [178, 108,  74,  45], [139,  84,  58,  36]],
29
-		[[370, 224, 154,  95], [293, 178, 122,  75], [207, 125,  86,  53], [154,  93,  64,  39]],
30
-		[[461, 279, 192, 118], [365, 221, 152,  93], [259, 157, 108,  66], [202, 122,  84,  52]],
31
-		[[552, 335, 230, 141], [432, 262, 180, 111], [312, 189, 130,  80], [235, 143,  98,  60]],
32
-		[[652, 395, 271, 167], [513, 311, 213, 131], [364, 221, 151,  93], [288, 174, 119,  74]],
23
+		[[41, 25, 17, 10], [34, 20, 14, 8], [27, 16, 11, 7], [17, 10, 7, 4]],
24
+		[[77, 47, 32, 20], [63, 38, 26, 16], [48, 29, 20, 12], [34, 20, 14, 8]],
25
+		[[127, 77, 53, 32], [101, 61, 42, 26], [77, 47, 32, 20], [58, 35, 24, 15]],
26
+		[[187, 114, 78, 48], [149, 90, 62, 38], [111, 67, 46, 28], [82, 50, 34, 21]],
27
+		[[255, 154, 106, 65], [202, 122, 84, 52], [144, 87, 60, 37], [106, 64, 44, 27]],
28
+		[[322, 195, 134, 82], [255, 154, 106, 65], [178, 108, 74, 45], [139, 84, 58, 36]],
29
+		[[370, 224, 154, 95], [293, 178, 122, 75], [207, 125, 86, 53], [154, 93, 64, 39]],
30
+		[[461, 279, 192, 118], [365, 221, 152, 93], [259, 157, 108, 66], [202, 122, 84, 52]],
31
+		[[552, 335, 230, 141], [432, 262, 180, 111], [312, 189, 130, 80], [235, 143, 98, 60]],
32
+		[[652, 395, 271, 167], [513, 311, 213, 131], [364, 221, 151, 93], [288, 174, 119, 74]],
33 33
 	];
34 34
 
35 35
 	const BLOCK_TABLE = [
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		[1, 26, 19], // L
38 38
 		[1, 26, 16], // M
39 39
 		[1, 26, 13], // Q
40
-		[1, 26,  9], // H
40
+		[1, 26, 9], // H
41 41
 		// 2
42 42
 		[1, 44, 34],
43 43
 		[1, 44, 28],
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
 		[2, 35, 13],
51 51
 		// 4
52 52
 		[1, 100, 80],
53
-		[2,  50, 32],
54
-		[2,  50, 24],
55
-		[4,  25,  9],
53
+		[2, 50, 32],
54
+		[2, 50, 24],
55
+		[4, 25, 9],
56 56
 		// 5
57 57
 		[1, 134, 108],
58
-		[2,  67,  43],
59
-		[2,  33,  15, 2, 34, 16],
60
-		[2,  33,  11, 2, 34, 12],
58
+		[2, 67, 43],
59
+		[2, 33, 15, 2, 34, 16],
60
+		[2, 33, 11, 2, 34, 12],
61 61
 		// 6
62 62
 		[2, 86, 68],
63 63
 		[4, 43, 27],
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
 		[4, 39, 13, 1, 40, 14],
71 71
 		// 8
72 72
 		[2, 121, 97],
73
-		[2,  60, 38, 2, 61, 39],
74
-		[4,  40, 18, 2, 41, 19],
75
-		[4,  40, 14, 2, 41, 15],
73
+		[2, 60, 38, 2, 61, 39],
74
+		[4, 40, 18, 2, 41, 19],
75
+		[4, 40, 14, 2, 41, 15],
76 76
 		// 9
77 77
 		[2, 146, 116],
78
-		[3,  58,  36, 2, 59, 37],
79
-		[4,  36,  16, 4, 37, 17],
80
-		[4,  36,  12, 4, 37, 13],
78
+		[3, 58, 36, 2, 59, 37],
79
+		[4, 36, 16, 4, 37, 17],
80
+		[4, 36, 12, 4, 37, 13],
81 81
 		// 10
82 82
 		[2, 86, 68, 2, 87, 69],
83 83
 		[4, 69, 43, 1, 70, 44],
Please login to merge, or discard this patch.