@@ -47,7 +47,7 @@ |
||
47 | 47 | if(preg_match('/[a-f\d]{6}/i', $v) === 1){ |
48 | 48 | return in_array($_POST['output_type'], ['png', 'jpg', 'gif']) |
49 | 49 | ? array_map('hexdec', str_split($v, 2)) |
50 | - : '#'.$v ; |
|
50 | + : '#'.$v; |
|
51 | 51 | } |
52 | 52 | return null; |
53 | 53 | }, $moduleValues); |
@@ -140,7 +140,6 @@ |
||
140 | 140 | * @param string|null $file |
141 | 141 | * |
142 | 142 | * @return string |
143 | - |
|
144 | 143 | * @throws \chillerlan\QRCode\Output\QRCodeOutputException |
145 | 144 | */ |
146 | 145 | protected function dumpImage(string $file = null):string{ |
@@ -74,7 +74,7 @@ |
||
74 | 74 | // avoid: Indirect modification of overloaded property $imageTransparencyBG has no effect |
75 | 75 | // https://stackoverflow.com/a/10455217 |
76 | 76 | $tbg = $this->options->imageTransparencyBG; |
77 | - $background = imagecolorallocate($this->image, ...$tbg); |
|
77 | + $background = imagecolorallocate($this->image, ...$tbg); |
|
78 | 78 | |
79 | 79 | if((bool)$this->options->imageTransparent && in_array($this->options->outputType, $this::TRANSPARENCY_TYPES, true)){ |
80 | 80 | imagecolortransparent($this->image, $background); |
@@ -23,38 +23,38 @@ |
||
23 | 23 | * @link http://www.thonky.com/qr-code-tutorial/log-antilog-table |
24 | 24 | */ |
25 | 25 | protected const table = [ |
26 | - [ 1, 0], [ 2, 0], [ 4, 1], [ 8, 25], [ 16, 2], [ 32, 50], [ 64, 26], [128, 198], |
|
27 | - [ 29, 3], [ 58, 223], [116, 51], [232, 238], [205, 27], [135, 104], [ 19, 199], [ 38, 75], |
|
28 | - [ 76, 4], [152, 100], [ 45, 224], [ 90, 14], [180, 52], [117, 141], [234, 239], [201, 129], |
|
29 | - [143, 28], [ 3, 193], [ 6, 105], [ 12, 248], [ 24, 200], [ 48, 8], [ 96, 76], [192, 113], |
|
30 | - [157, 5], [ 39, 138], [ 78, 101], [156, 47], [ 37, 225], [ 74, 36], [148, 15], [ 53, 33], |
|
31 | - [106, 53], [212, 147], [181, 142], [119, 218], [238, 240], [193, 18], [159, 130], [ 35, 69], |
|
32 | - [ 70, 29], [140, 181], [ 5, 194], [ 10, 125], [ 20, 106], [ 40, 39], [ 80, 249], [160, 185], |
|
33 | - [ 93, 201], [186, 154], [105, 9], [210, 120], [185, 77], [111, 228], [222, 114], [161, 166], |
|
34 | - [ 95, 6], [190, 191], [ 97, 139], [194, 98], [153, 102], [ 47, 221], [ 94, 48], [188, 253], |
|
35 | - [101, 226], [202, 152], [137, 37], [ 15, 179], [ 30, 16], [ 60, 145], [120, 34], [240, 136], |
|
36 | - [253, 54], [231, 208], [211, 148], [187, 206], [107, 143], [214, 150], [177, 219], [127, 189], |
|
37 | - [254, 241], [225, 210], [223, 19], [163, 92], [ 91, 131], [182, 56], [113, 70], [226, 64], |
|
38 | - [217, 30], [175, 66], [ 67, 182], [134, 163], [ 17, 195], [ 34, 72], [ 68, 126], [136, 110], |
|
39 | - [ 13, 107], [ 26, 58], [ 52, 40], [104, 84], [208, 250], [189, 133], [103, 186], [206, 61], |
|
40 | - [129, 202], [ 31, 94], [ 62, 155], [124, 159], [248, 10], [237, 21], [199, 121], [147, 43], |
|
41 | - [ 59, 78], [118, 212], [236, 229], [197, 172], [151, 115], [ 51, 243], [102, 167], [204, 87], |
|
42 | - [133, 7], [ 23, 112], [ 46, 192], [ 92, 247], [184, 140], [109, 128], [218, 99], [169, 13], |
|
43 | - [ 79, 103], [158, 74], [ 33, 222], [ 66, 237], [132, 49], [ 21, 197], [ 42, 254], [ 84, 24], |
|
44 | - [168, 227], [ 77, 165], [154, 153], [ 41, 119], [ 82, 38], [164, 184], [ 85, 180], [170, 124], |
|
45 | - [ 73, 17], [146, 68], [ 57, 146], [114, 217], [228, 35], [213, 32], [183, 137], [115, 46], |
|
46 | - [230, 55], [209, 63], [191, 209], [ 99, 91], [198, 149], [145, 188], [ 63, 207], [126, 205], |
|
47 | - [252, 144], [229, 135], [215, 151], [179, 178], [123, 220], [246, 252], [241, 190], [255, 97], |
|
48 | - [227, 242], [219, 86], [171, 211], [ 75, 171], [150, 20], [ 49, 42], [ 98, 93], [196, 158], |
|
49 | - [149, 132], [ 55, 60], [110, 57], [220, 83], [165, 71], [ 87, 109], [174, 65], [ 65, 162], |
|
50 | - [130, 31], [ 25, 45], [ 50, 67], [100, 216], [200, 183], [141, 123], [ 7, 164], [ 14, 118], |
|
51 | - [ 28, 196], [ 56, 23], [112, 73], [224, 236], [221, 127], [167, 12], [ 83, 111], [166, 246], |
|
52 | - [ 81, 108], [162, 161], [ 89, 59], [178, 82], [121, 41], [242, 157], [249, 85], [239, 170], |
|
53 | - [195, 251], [155, 96], [ 43, 134], [ 86, 177], [172, 187], [ 69, 204], [138, 62], [ 9, 90], |
|
54 | - [ 18, 203], [ 36, 89], [ 72, 95], [144, 176], [ 61, 156], [122, 169], [244, 160], [245, 81], |
|
55 | - [247, 11], [243, 245], [251, 22], [235, 235], [203, 122], [139, 117], [ 11, 44], [ 22, 215], |
|
56 | - [ 44, 79], [ 88, 174], [176, 213], [125, 233], [250, 230], [233, 231], [207, 173], [131, 232], |
|
57 | - [ 27, 116], [ 54, 214], [108, 244], [216, 234], [173, 168], [ 71, 80], [142, 88], [ 1, 175], |
|
26 | + [1, 0], [2, 0], [4, 1], [8, 25], [16, 2], [32, 50], [64, 26], [128, 198], |
|
27 | + [29, 3], [58, 223], [116, 51], [232, 238], [205, 27], [135, 104], [19, 199], [38, 75], |
|
28 | + [76, 4], [152, 100], [45, 224], [90, 14], [180, 52], [117, 141], [234, 239], [201, 129], |
|
29 | + [143, 28], [3, 193], [6, 105], [12, 248], [24, 200], [48, 8], [96, 76], [192, 113], |
|
30 | + [157, 5], [39, 138], [78, 101], [156, 47], [37, 225], [74, 36], [148, 15], [53, 33], |
|
31 | + [106, 53], [212, 147], [181, 142], [119, 218], [238, 240], [193, 18], [159, 130], [35, 69], |
|
32 | + [70, 29], [140, 181], [5, 194], [10, 125], [20, 106], [40, 39], [80, 249], [160, 185], |
|
33 | + [93, 201], [186, 154], [105, 9], [210, 120], [185, 77], [111, 228], [222, 114], [161, 166], |
|
34 | + [95, 6], [190, 191], [97, 139], [194, 98], [153, 102], [47, 221], [94, 48], [188, 253], |
|
35 | + [101, 226], [202, 152], [137, 37], [15, 179], [30, 16], [60, 145], [120, 34], [240, 136], |
|
36 | + [253, 54], [231, 208], [211, 148], [187, 206], [107, 143], [214, 150], [177, 219], [127, 189], |
|
37 | + [254, 241], [225, 210], [223, 19], [163, 92], [91, 131], [182, 56], [113, 70], [226, 64], |
|
38 | + [217, 30], [175, 66], [67, 182], [134, 163], [17, 195], [34, 72], [68, 126], [136, 110], |
|
39 | + [13, 107], [26, 58], [52, 40], [104, 84], [208, 250], [189, 133], [103, 186], [206, 61], |
|
40 | + [129, 202], [31, 94], [62, 155], [124, 159], [248, 10], [237, 21], [199, 121], [147, 43], |
|
41 | + [59, 78], [118, 212], [236, 229], [197, 172], [151, 115], [51, 243], [102, 167], [204, 87], |
|
42 | + [133, 7], [23, 112], [46, 192], [92, 247], [184, 140], [109, 128], [218, 99], [169, 13], |
|
43 | + [79, 103], [158, 74], [33, 222], [66, 237], [132, 49], [21, 197], [42, 254], [84, 24], |
|
44 | + [168, 227], [77, 165], [154, 153], [41, 119], [82, 38], [164, 184], [85, 180], [170, 124], |
|
45 | + [73, 17], [146, 68], [57, 146], [114, 217], [228, 35], [213, 32], [183, 137], [115, 46], |
|
46 | + [230, 55], [209, 63], [191, 209], [99, 91], [198, 149], [145, 188], [63, 207], [126, 205], |
|
47 | + [252, 144], [229, 135], [215, 151], [179, 178], [123, 220], [246, 252], [241, 190], [255, 97], |
|
48 | + [227, 242], [219, 86], [171, 211], [75, 171], [150, 20], [49, 42], [98, 93], [196, 158], |
|
49 | + [149, 132], [55, 60], [110, 57], [220, 83], [165, 71], [87, 109], [174, 65], [65, 162], |
|
50 | + [130, 31], [25, 45], [50, 67], [100, 216], [200, 183], [141, 123], [7, 164], [14, 118], |
|
51 | + [28, 196], [56, 23], [112, 73], [224, 236], [221, 127], [167, 12], [83, 111], [166, 246], |
|
52 | + [81, 108], [162, 161], [89, 59], [178, 82], [121, 41], [242, 157], [249, 85], [239, 170], |
|
53 | + [195, 251], [155, 96], [43, 134], [86, 177], [172, 187], [69, 204], [138, 62], [9, 90], |
|
54 | + [18, 203], [36, 89], [72, 95], [144, 176], [61, 156], [122, 169], [244, 160], [245, 81], |
|
55 | + [247, 11], [243, 245], [251, 22], [235, 235], [203, 122], [139, 117], [11, 44], [22, 215], |
|
56 | + [44, 79], [88, 174], [176, 213], [125, 233], [250, 230], [233, 231], [207, 173], [131, 232], |
|
57 | + [27, 116], [54, 214], [108, 244], [216, 234], [173, 168], [71, 80], [142, 88], [1, 175], |
|
58 | 58 | ]; |
59 | 59 | |
60 | 60 | /** |
@@ -293,7 +293,7 @@ |
||
293 | 293 | $this->dcdata[$key] = array_fill(0, $dcCount, null); |
294 | 294 | |
295 | 295 | foreach($this->dcdata[$key] as $a => $_z){ |
296 | - $this->dcdata[$key][$a] = 0xff & $this->bitBuffer->buffer[$a + $offset]; |
|
296 | + $this->dcdata[$key][$a] = 0xff&$this->bitBuffer->buffer[$a + $offset]; |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | [$num, $add] = $this->poly($key, $ecCount); |
@@ -84,9 +84,9 @@ |
||
84 | 84 | $matrix = $this->matrix->matrix(); |
85 | 85 | |
86 | 86 | $svg = sprintf($this->svgHeader, $this->options->cssClass, $this->options->svgViewBoxSize ?? $this->moduleCount) |
87 | - .$this->options->eol |
|
88 | - .'<defs>'.$this->options->svgDefs.'</defs>' |
|
89 | - .$this->options->eol; |
|
87 | + .$this->options->eol |
|
88 | + .'<defs>'.$this->options->svgDefs.'</defs>' |
|
89 | + .$this->options->eol; |
|
90 | 90 | |
91 | 91 | foreach($this->moduleValues as $M_TYPE => $value){ |
92 | 92 | $path = ''; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $len = strlen($data); |
49 | 49 | |
50 | 50 | for($i = 0; $i + 1 < $len; $i += 2){ |
51 | - $c = ((0xff & ord($data[$i])) << 8) | (0xff & ord($data[$i + 1])); |
|
51 | + $c = ((0xff&ord($data[$i])) << 8)|(0xff&ord($data[$i + 1])); |
|
52 | 52 | |
53 | 53 | if(0x8140 <= $c && $c <= 0x9FFC){ |
54 | 54 | $c -= 0x8140; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | throw new QRCodeDataException(sprintf('illegal char at %d [%d]', $i + 1, $c)); |
61 | 61 | } |
62 | 62 | |
63 | - $this->bitBuffer->put((($c >> 8) & 0xff) * 0xC0 + ($c & 0xff), 13); |
|
63 | + $this->bitBuffer->put((($c >> 8)&0xff) * 0xC0 + ($c&0xff), 13); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 |
@@ -289,7 +289,7 @@ |
||
289 | 289 | $len = strlen($string); |
290 | 290 | |
291 | 291 | while($i + 1 < $len){ |
292 | - $c = ((0xff & ord($string[$i])) << 8) | (0xff & ord($string[$i + 1])); |
|
292 | + $c = ((0xff&ord($string[$i])) << 8)|(0xff&ord($string[$i + 1])); |
|
293 | 293 | |
294 | 294 | if(!($c >= 0x8140 && $c <= 0x9FFC) && !($c >= 0xE040 && $c <= 0xEBBF)){ |
295 | 295 | return false; |
@@ -45,7 +45,7 @@ |
||
45 | 45 | public function put(int $num, int $length):BitBuffer{ |
46 | 46 | |
47 | 47 | for($i = 0; $i < $length; $i++){ |
48 | - $this->putBit((($num >> ($length - $i - 1)) & 1) === 1); |
|
48 | + $this->putBit((($num >> ($length - $i - 1))&1) === 1); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $this; |
@@ -12,8 +12,8 @@ |
||
12 | 12 | |
13 | 13 | namespace chillerlan\QRCode\Data; |
14 | 14 | |
15 | -use chillerlan\QRCode\QRCode; |
|
16 | 15 | use Closure; |
16 | +use chillerlan\QRCode\QRCode; |
|
17 | 17 | |
18 | 18 | use function array_fill, array_key_exists, array_push, array_unshift, count, floor, in_array, max, min, range; |
19 | 19 |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | 18 => [6, 30, 56, 82], |
64 | 64 | 19 => [6, 30, 58, 86], |
65 | 65 | 20 => [6, 34, 62, 90], |
66 | - 21 => [6, 28, 50, 72, 94], |
|
67 | - 22 => [6, 26, 50, 74, 98], |
|
66 | + 21 => [6, 28, 50, 72, 94], |
|
67 | + 22 => [6, 26, 50, 74, 98], |
|
68 | 68 | 23 => [6, 30, 54, 78, 102], |
69 | 69 | 24 => [6, 28, 54, 80, 106], |
70 | 70 | 25 => [6, 32, 58, 84, 110], |
71 | 71 | 26 => [6, 30, 58, 86, 114], |
72 | 72 | 27 => [6, 34, 62, 90, 118], |
73 | - 28 => [6, 26, 50, 74, 98, 122], |
|
73 | + 28 => [6, 26, 50, 74, 98, 122], |
|
74 | 74 | 29 => [6, 30, 54, 78, 102, 126], |
75 | 75 | 30 => [6, 26, 52, 78, 104, 130], |
76 | 76 | 31 => [6, 30, 56, 82, 108, 134], |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | // ECC level -> mask pattern |
131 | 131 | protected const formatPattern = [ |
132 | - [ // L |
|
132 | + [// L |
|
133 | 133 | 0b111011111000100, |
134 | 134 | 0b111001011110011, |
135 | 135 | 0b111110110101010, |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | 0b110110001000001, |
140 | 140 | 0b110100101110110, |
141 | 141 | ], |
142 | - [ // M |
|
142 | + [// M |
|
143 | 143 | 0b101010000010010, |
144 | 144 | 0b101000100100101, |
145 | 145 | 0b101111001111100, |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | 0b100111110010111, |
150 | 150 | 0b100101010100000, |
151 | 151 | ], |
152 | - [ // Q |
|
152 | + [// Q |
|
153 | 153 | 0b011010101011111, |
154 | 154 | 0b011000001101000, |
155 | 155 | 0b011111100110001, |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | 0b010111011011010, |
160 | 160 | 0b010101111101101, |
161 | 161 | ], |
162 | - [ // H |
|
162 | + [// H |
|
163 | 163 | 0b001011010001001, |
164 | 164 | 0b001001110111110, |
165 | 165 | 0b001110011100111, |
@@ -393,8 +393,8 @@ discard block |
||
393 | 393 | |
394 | 394 | for($c = 0; $c < 3; $c++){ |
395 | 395 | for($i = 0; $i < 8; $i++){ |
396 | - $this->set($h[$c][0] , $h[$c][1] + $i, false, $this::M_SEPARATOR); |
|
397 | - $this->set($v[$c][0] - $i, $v[$c][1] , false, $this::M_SEPARATOR); |
|
396 | + $this->set($h[$c][0], $h[$c][1] + $i, false, $this::M_SEPARATOR); |
|
397 | + $this->set($v[$c][0] - $i, $v[$c][1], false, $this::M_SEPARATOR); |
|
398 | 398 | } |
399 | 399 | } |
400 | 400 | |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | for($i = 0; $i < 18; $i++){ |
470 | 470 | $a = (int)floor($i / 3); |
471 | 471 | $b = $i % 3 + $this->moduleCount - 8 - 3; |
472 | - $v = !$test && (($bits >> $i) & 1) === 1; |
|
472 | + $v = !$test && (($bits >> $i)&1) === 1; |
|
473 | 473 | |
474 | 474 | $this->set($b, $a, $v, $this::M_VERSION); // ne |
475 | 475 | $this->set($a, $b, $v, $this::M_VERSION); // sw |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | $bits = $this::formatPattern[QRCode::ECC_MODES[$this->eclevel]][$maskPattern] ?? 0; |
493 | 493 | |
494 | 494 | for($i = 0; $i < 15; $i++){ |
495 | - $v = !$test && (($bits >> $i) & 1) === 1; |
|
495 | + $v = !$test && (($bits >> $i)&1) === 1; |
|
496 | 496 | |
497 | 497 | if($i < 6){ |
498 | 498 | $this->set(8, $i, $v, $this::M_FORMAT); |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | foreach($this->matrix as $y => $row){ |
622 | 622 | foreach($row as $x => $val){ |
623 | 623 | // out of bounds, skip |
624 | - if($x < $start || $y < $start ||$x >= $end || $y >= $end){ |
|
624 | + if($x < $start || $y < $start || $x >= $end || $y >= $end){ |
|
625 | 625 | continue; |
626 | 626 | } |
627 | 627 | // a match |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | $size = $this->moduleCount - 1; |
651 | 651 | $mask = $this->getMask($this->maskPattern); |
652 | 652 | |
653 | - for($i = $size, $y = $size, $inc = -1, $byteIndex = 0, $bitIndex = 7; $i > 0; $i -= 2){ |
|
653 | + for($i = $size, $y = $size, $inc = -1, $byteIndex = 0, $bitIndex = 7; $i > 0; $i -= 2){ |
|
654 | 654 | |
655 | 655 | if($i === 6){ |
656 | 656 | $i--; |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | $v = false; |
665 | 665 | |
666 | 666 | if($byteIndex < $byteCount){ |
667 | - $v = (($data[$byteIndex] >> $bitIndex) & 1) === 1; |
|
667 | + $v = (($data[$byteIndex] >> $bitIndex)&1) === 1; |
|
668 | 668 | } |
669 | 669 | |
670 | 670 | if($mask($x, $y) === 0){ |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | $y += $inc; |
686 | 686 | |
687 | 687 | if($y < 0 || $this->moduleCount <= $y){ |
688 | - $y -= $inc; |
|
688 | + $y -= $inc; |
|
689 | 689 | $inc = -$inc; |
690 | 690 | |
691 | 691 | break; |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | */ |
715 | 715 | protected function getMask(int $maskPattern):Closure{ |
716 | 716 | |
717 | - if((0b111 & $maskPattern) !== $maskPattern){ |
|
717 | + if((0b111&$maskPattern) !== $maskPattern){ |
|
718 | 718 | throw new QRCodeDataException('invalid mask pattern'); // @codeCoverageIgnore |
719 | 719 | } |
720 | 720 |