@@ -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); |
@@ -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; |
@@ -27,38 +27,38 @@ |
||
27 | 27 | * @see http://www.thonky.com/qr-code-tutorial/log-antilog-table |
28 | 28 | */ |
29 | 29 | protected const table = [ |
30 | - [ 1, 0], [ 2, 0], [ 4, 1], [ 8, 25], [ 16, 2], [ 32, 50], [ 64, 26], [128, 198], |
|
31 | - [ 29, 3], [ 58, 223], [116, 51], [232, 238], [205, 27], [135, 104], [ 19, 199], [ 38, 75], |
|
32 | - [ 76, 4], [152, 100], [ 45, 224], [ 90, 14], [180, 52], [117, 141], [234, 239], [201, 129], |
|
33 | - [143, 28], [ 3, 193], [ 6, 105], [ 12, 248], [ 24, 200], [ 48, 8], [ 96, 76], [192, 113], |
|
34 | - [157, 5], [ 39, 138], [ 78, 101], [156, 47], [ 37, 225], [ 74, 36], [148, 15], [ 53, 33], |
|
35 | - [106, 53], [212, 147], [181, 142], [119, 218], [238, 240], [193, 18], [159, 130], [ 35, 69], |
|
36 | - [ 70, 29], [140, 181], [ 5, 194], [ 10, 125], [ 20, 106], [ 40, 39], [ 80, 249], [160, 185], |
|
37 | - [ 93, 201], [186, 154], [105, 9], [210, 120], [185, 77], [111, 228], [222, 114], [161, 166], |
|
38 | - [ 95, 6], [190, 191], [ 97, 139], [194, 98], [153, 102], [ 47, 221], [ 94, 48], [188, 253], |
|
39 | - [101, 226], [202, 152], [137, 37], [ 15, 179], [ 30, 16], [ 60, 145], [120, 34], [240, 136], |
|
40 | - [253, 54], [231, 208], [211, 148], [187, 206], [107, 143], [214, 150], [177, 219], [127, 189], |
|
41 | - [254, 241], [225, 210], [223, 19], [163, 92], [ 91, 131], [182, 56], [113, 70], [226, 64], |
|
42 | - [217, 30], [175, 66], [ 67, 182], [134, 163], [ 17, 195], [ 34, 72], [ 68, 126], [136, 110], |
|
43 | - [ 13, 107], [ 26, 58], [ 52, 40], [104, 84], [208, 250], [189, 133], [103, 186], [206, 61], |
|
44 | - [129, 202], [ 31, 94], [ 62, 155], [124, 159], [248, 10], [237, 21], [199, 121], [147, 43], |
|
45 | - [ 59, 78], [118, 212], [236, 229], [197, 172], [151, 115], [ 51, 243], [102, 167], [204, 87], |
|
46 | - [133, 7], [ 23, 112], [ 46, 192], [ 92, 247], [184, 140], [109, 128], [218, 99], [169, 13], |
|
47 | - [ 79, 103], [158, 74], [ 33, 222], [ 66, 237], [132, 49], [ 21, 197], [ 42, 254], [ 84, 24], |
|
48 | - [168, 227], [ 77, 165], [154, 153], [ 41, 119], [ 82, 38], [164, 184], [ 85, 180], [170, 124], |
|
49 | - [ 73, 17], [146, 68], [ 57, 146], [114, 217], [228, 35], [213, 32], [183, 137], [115, 46], |
|
50 | - [230, 55], [209, 63], [191, 209], [ 99, 91], [198, 149], [145, 188], [ 63, 207], [126, 205], |
|
51 | - [252, 144], [229, 135], [215, 151], [179, 178], [123, 220], [246, 252], [241, 190], [255, 97], |
|
52 | - [227, 242], [219, 86], [171, 211], [ 75, 171], [150, 20], [ 49, 42], [ 98, 93], [196, 158], |
|
53 | - [149, 132], [ 55, 60], [110, 57], [220, 83], [165, 71], [ 87, 109], [174, 65], [ 65, 162], |
|
54 | - [130, 31], [ 25, 45], [ 50, 67], [100, 216], [200, 183], [141, 123], [ 7, 164], [ 14, 118], |
|
55 | - [ 28, 196], [ 56, 23], [112, 73], [224, 236], [221, 127], [167, 12], [ 83, 111], [166, 246], |
|
56 | - [ 81, 108], [162, 161], [ 89, 59], [178, 82], [121, 41], [242, 157], [249, 85], [239, 170], |
|
57 | - [195, 251], [155, 96], [ 43, 134], [ 86, 177], [172, 187], [ 69, 204], [138, 62], [ 9, 90], |
|
58 | - [ 18, 203], [ 36, 89], [ 72, 95], [144, 176], [ 61, 156], [122, 169], [244, 160], [245, 81], |
|
59 | - [247, 11], [243, 245], [251, 22], [235, 235], [203, 122], [139, 117], [ 11, 44], [ 22, 215], |
|
60 | - [ 44, 79], [ 88, 174], [176, 213], [125, 233], [250, 230], [233, 231], [207, 173], [131, 232], |
|
61 | - [ 27, 116], [ 54, 214], [108, 244], [216, 234], [173, 168], [ 71, 80], [142, 88], [ 1, 175], |
|
30 | + [1, 0], [2, 0], [4, 1], [8, 25], [16, 2], [32, 50], [64, 26], [128, 198], |
|
31 | + [29, 3], [58, 223], [116, 51], [232, 238], [205, 27], [135, 104], [19, 199], [38, 75], |
|
32 | + [76, 4], [152, 100], [45, 224], [90, 14], [180, 52], [117, 141], [234, 239], [201, 129], |
|
33 | + [143, 28], [3, 193], [6, 105], [12, 248], [24, 200], [48, 8], [96, 76], [192, 113], |
|
34 | + [157, 5], [39, 138], [78, 101], [156, 47], [37, 225], [74, 36], [148, 15], [53, 33], |
|
35 | + [106, 53], [212, 147], [181, 142], [119, 218], [238, 240], [193, 18], [159, 130], [35, 69], |
|
36 | + [70, 29], [140, 181], [5, 194], [10, 125], [20, 106], [40, 39], [80, 249], [160, 185], |
|
37 | + [93, 201], [186, 154], [105, 9], [210, 120], [185, 77], [111, 228], [222, 114], [161, 166], |
|
38 | + [95, 6], [190, 191], [97, 139], [194, 98], [153, 102], [47, 221], [94, 48], [188, 253], |
|
39 | + [101, 226], [202, 152], [137, 37], [15, 179], [30, 16], [60, 145], [120, 34], [240, 136], |
|
40 | + [253, 54], [231, 208], [211, 148], [187, 206], [107, 143], [214, 150], [177, 219], [127, 189], |
|
41 | + [254, 241], [225, 210], [223, 19], [163, 92], [91, 131], [182, 56], [113, 70], [226, 64], |
|
42 | + [217, 30], [175, 66], [67, 182], [134, 163], [17, 195], [34, 72], [68, 126], [136, 110], |
|
43 | + [13, 107], [26, 58], [52, 40], [104, 84], [208, 250], [189, 133], [103, 186], [206, 61], |
|
44 | + [129, 202], [31, 94], [62, 155], [124, 159], [248, 10], [237, 21], [199, 121], [147, 43], |
|
45 | + [59, 78], [118, 212], [236, 229], [197, 172], [151, 115], [51, 243], [102, 167], [204, 87], |
|
46 | + [133, 7], [23, 112], [46, 192], [92, 247], [184, 140], [109, 128], [218, 99], [169, 13], |
|
47 | + [79, 103], [158, 74], [33, 222], [66, 237], [132, 49], [21, 197], [42, 254], [84, 24], |
|
48 | + [168, 227], [77, 165], [154, 153], [41, 119], [82, 38], [164, 184], [85, 180], [170, 124], |
|
49 | + [73, 17], [146, 68], [57, 146], [114, 217], [228, 35], [213, 32], [183, 137], [115, 46], |
|
50 | + [230, 55], [209, 63], [191, 209], [99, 91], [198, 149], [145, 188], [63, 207], [126, 205], |
|
51 | + [252, 144], [229, 135], [215, 151], [179, 178], [123, 220], [246, 252], [241, 190], [255, 97], |
|
52 | + [227, 242], [219, 86], [171, 211], [75, 171], [150, 20], [49, 42], [98, 93], [196, 158], |
|
53 | + [149, 132], [55, 60], [110, 57], [220, 83], [165, 71], [87, 109], [174, 65], [65, 162], |
|
54 | + [130, 31], [25, 45], [50, 67], [100, 216], [200, 183], [141, 123], [7, 164], [14, 118], |
|
55 | + [28, 196], [56, 23], [112, 73], [224, 236], [221, 127], [167, 12], [83, 111], [166, 246], |
|
56 | + [81, 108], [162, 161], [89, 59], [178, 82], [121, 41], [242, 157], [249, 85], [239, 170], |
|
57 | + [195, 251], [155, 96], [43, 134], [86, 177], [172, 187], [69, 204], [138, 62], [9, 90], |
|
58 | + [18, 203], [36, 89], [72, 95], [144, 176], [61, 156], [122, 169], [244, 160], [245, 81], |
|
59 | + [247, 11], [243, 245], [251, 22], [235, 235], [203, 122], [139, 117], [11, 44], [22, 215], |
|
60 | + [44, 79], [88, 174], [176, 213], [125, 233], [250, 230], [233, 231], [207, 173], [131, 232], |
|
61 | + [27, 116], [54, 214], [108, 244], [216, 234], [173, 168], [71, 80], [142, 88], [1, 175], |
|
62 | 62 | ]; |
63 | 63 | |
64 | 64 | /** |
@@ -32,15 +32,15 @@ |
||
32 | 32 | QRMatrix::M_LOGO => false, // 20 |
33 | 33 | QRMatrix::M_TEST => false, // 255 |
34 | 34 | // dark |
35 | - QRMatrix::M_DARKMODULE << 8 => true, // 512 |
|
36 | - QRMatrix::M_DATA << 8 => true, // 1024 |
|
37 | - QRMatrix::M_FINDER << 8 => true, // 1536 |
|
38 | - QRMatrix::M_ALIGNMENT << 8 => true, // 2560 |
|
39 | - QRMatrix::M_TIMING << 8 => true, // 3072 |
|
40 | - QRMatrix::M_FORMAT << 8 => true, // 3584 |
|
41 | - QRMatrix::M_VERSION << 8 => true, // 4096 |
|
42 | - QRMatrix::M_FINDER_DOT << 8 => true, // 5632 |
|
43 | - QRMatrix::M_TEST << 8 => true, // 65280 |
|
35 | + QRMatrix::M_DARKMODULE << 8 => true, // 512 |
|
36 | + QRMatrix::M_DATA << 8 => true, // 1024 |
|
37 | + QRMatrix::M_FINDER << 8 => true, // 1536 |
|
38 | + QRMatrix::M_ALIGNMENT << 8 => true, // 2560 |
|
39 | + QRMatrix::M_TIMING << 8 => true, // 3072 |
|
40 | + QRMatrix::M_FORMAT << 8 => true, // 3584 |
|
41 | + QRMatrix::M_VERSION << 8 => true, // 4096 |
|
42 | + QRMatrix::M_FINDER_DOT << 8 => true, // 5632 |
|
43 | + QRMatrix::M_TEST << 8 => true, // 65280 |
|
44 | 44 | ]; |
45 | 45 | |
46 | 46 | /** |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @see \sprintf() |
28 | 28 | */ |
29 | 29 | protected string $svgHeader = '<svg xmlns="http://www.w3.org/2000/svg" class="qr-svg %1$s" '. |
30 | - 'style="width: 100%%; height: auto;" viewBox="0 0 %2$d %2$d">'; |
|
30 | + 'style="width: 100%%; height: auto;" viewBox="0 0 %2$d %2$d">'; |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * @inheritDoc |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | |
76 | 76 | if($file !== null){ |
77 | 77 | return '<!DOCTYPE html>'. |
78 | - '<head><meta charset="UTF-8"><title>QR Code</title></head>'. |
|
79 | - '<body>'.$this->options->eol.$html.'</body>'; |
|
78 | + '<head><meta charset="UTF-8"><title>QR Code</title></head>'. |
|
79 | + '<body>'.$this->options->eol.$html.'</body>'; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | return $html; |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | $matrix = $this->matrix->matrix(); |
92 | 92 | |
93 | 93 | $svg = sprintf($this->svgHeader, $this->options->cssClass, $this->options->svgViewBoxSize ?? $this->moduleCount) |
94 | - .$this->options->eol |
|
95 | - .'<defs>'.$this->options->svgDefs.'</defs>' |
|
96 | - .$this->options->eol; |
|
94 | + .$this->options->eol |
|
95 | + .'<defs>'.$this->options->svgDefs.'</defs>' |
|
96 | + .$this->options->eol; |
|
97 | 97 | |
98 | 98 | foreach($this->moduleValues as $M_TYPE => $value){ |
99 | 99 | $path = ''; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | // if saving to file, append the correct headers |
148 | 148 | if($file !== null){ |
149 | 149 | return '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'. |
150 | - $this->options->eol.$svg; |
|
150 | + $this->options->eol.$svg; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | if($this->options->imageBase64){ |
@@ -245,7 +245,7 @@ |
||
245 | 245 | $this->dcdata[$key] = array_fill(0, $dcCount, null); |
246 | 246 | |
247 | 247 | foreach($this->dcdata[$key] as $a => $_z){ |
248 | - $this->dcdata[$key][$a] = 0xff & $bitBuffer[$a + $offset]; |
|
248 | + $this->dcdata[$key][$a] = 0xff&$bitBuffer[$a + $offset]; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | [$num, $add] = $this->poly($key, $ecCount); |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | |
258 | 258 | for($c = 0; $c < 3; $c++){ |
259 | 259 | for($i = 0; $i < 8; $i++){ |
260 | - $this->set($h[$c][0] , $h[$c][1] + $i, false, $this::M_SEPARATOR); |
|
261 | - $this->set($v[$c][0] - $i, $v[$c][1] , false, $this::M_SEPARATOR); |
|
260 | + $this->set($h[$c][0], $h[$c][1] + $i, false, $this::M_SEPARATOR); |
|
261 | + $this->set($v[$c][0] - $i, $v[$c][1], false, $this::M_SEPARATOR); |
|
262 | 262 | } |
263 | 263 | } |
264 | 264 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | for($i = 0; $i < 18; $i++){ |
333 | 333 | $a = (int)floor($i / 3); |
334 | 334 | $b = $i % 3 + $this->moduleCount - 8 - 3; |
335 | - $v = !$test && (($bits >> $i) & 1) === 1; |
|
335 | + $v = !$test && (($bits >> $i)&1) === 1; |
|
336 | 336 | |
337 | 337 | $this->set($b, $a, $v, $this::M_VERSION); // ne |
338 | 338 | $this->set($a, $b, $v, $this::M_VERSION); // sw |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | $bits = $this->eccLevel->getformatPattern($maskPattern); |
353 | 353 | |
354 | 354 | for($i = 0; $i < 15; $i++){ |
355 | - $v = !$test && (($bits >> $i) & 1) === 1; |
|
355 | + $v = !$test && (($bits >> $i)&1) === 1; |
|
356 | 356 | |
357 | 357 | if($i < 6){ |
358 | 358 | $this->set(8, $i, $v, $this::M_FORMAT); |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | foreach($this->matrix as $y => $row){ |
475 | 475 | foreach($row as $x => $val){ |
476 | 476 | // out of bounds, skip |
477 | - if($x < $start || $y < $start ||$x >= $end || $y >= $end){ |
|
477 | + if($x < $start || $y < $start || $x >= $end || $y >= $end){ |
|
478 | 478 | continue; |
479 | 479 | } |
480 | 480 | // a match |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | $v = false; |
522 | 522 | |
523 | 523 | if($byteIndex < $byteCount){ |
524 | - $v = (($data[$byteIndex] >> $bitIndex) & 1) === 1; |
|
524 | + $v = (($data[$byteIndex] >> $bitIndex)&1) === 1; |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | if($mask($x, $y) === 0){ |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | $y += $inc; |
543 | 543 | |
544 | 544 | if($y < 0 || $this->moduleCount <= $y){ |
545 | - $y -= $inc; |
|
545 | + $y -= $inc; |
|
546 | 546 | $inc = -$inc; |
547 | 547 | |
548 | 548 | break; |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | */ |
569 | 569 | protected function getMask(int $maskPattern):Closure{ |
570 | 570 | |
571 | - if((0b111 & $maskPattern) !== $maskPattern){ |
|
571 | + if((0b111&$maskPattern) !== $maskPattern){ |
|
572 | 572 | throw new QRCodeDataException('invalid mask pattern'); // @codeCoverageIgnore |
573 | 573 | } |
574 | 574 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $len = strlen($string); |
57 | 57 | |
58 | 58 | while($i + 1 < $len){ |
59 | - $c = ((0xff & ord($string[$i])) << 8) | (0xff & ord($string[$i + 1])); |
|
59 | + $c = ((0xff&ord($string[$i])) << 8)|(0xff&ord($string[$i + 1])); |
|
60 | 60 | |
61 | 61 | if(!($c >= 0x8140 && $c <= 0x9FFC) && !($c >= 0xE040 && $c <= 0xEBBF)){ |
62 | 62 | return false; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $len = strlen($this->data); |
84 | 84 | |
85 | 85 | for($i = 0; $i + 1 < $len; $i += 2){ |
86 | - $c = ((0xff & ord($this->data[$i])) << 8) | (0xff & ord($this->data[$i + 1])); |
|
86 | + $c = ((0xff&ord($this->data[$i])) << 8)|(0xff&ord($this->data[$i + 1])); |
|
87 | 87 | |
88 | 88 | if($c >= 0x8140 && $c <= 0x9FFC){ |
89 | 89 | $c -= 0x8140; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | throw new QRCodeDataException(sprintf('illegal char at %d [%d]', $i + 1, $c)); |
96 | 96 | } |
97 | 97 | |
98 | - $bitBuffer->put(((($c >> 8) & 0xff) * 0xC0) + ($c & 0xff), 13); |
|
98 | + $bitBuffer->put(((($c >> 8)&0xff) * 0xC0) + ($c&0xff), 13); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | if($i < $len){ |
@@ -22,16 +22,16 @@ |
||
22 | 22 | */ |
23 | 23 | class ECI extends QRDataModeAbstract{ |
24 | 24 | |
25 | - public const CP437 = 0; // Code page 437, DOS Latin US |
|
26 | - 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 |
|
27 | - public const CP437_WO_GLI = 2; // An equivalent code table to CP437, without the return-to-GLI 0 logic |
|
28 | - public const ISO_IEC_8859_1 = 3; // Latin-1 (Default) |
|
29 | - public const ISO_IEC_8859_2 = 4; // Latin-2 |
|
30 | - public const ISO_IEC_8859_3 = 5; // Latin-3 |
|
31 | - public const ISO_IEC_8859_4 = 6; // Latin-4 |
|
32 | - public const ISO_IEC_8859_5 = 7; // Latin/Cyrillic |
|
33 | - public const ISO_IEC_8859_6 = 8; // Latin/Arabic |
|
34 | - public const ISO_IEC_8859_7 = 9; // Latin/Greek |
|
25 | + public const CP437 = 0; // Code page 437, DOS Latin US |
|
26 | + 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 |
|
27 | + public const CP437_WO_GLI = 2; // An equivalent code table to CP437, without the return-to-GLI 0 logic |
|
28 | + public const ISO_IEC_8859_1 = 3; // Latin-1 (Default) |
|
29 | + public const ISO_IEC_8859_2 = 4; // Latin-2 |
|
30 | + public const ISO_IEC_8859_3 = 5; // Latin-3 |
|
31 | + public const ISO_IEC_8859_4 = 6; // Latin-4 |
|
32 | + public const ISO_IEC_8859_5 = 7; // Latin/Cyrillic |
|
33 | + public const ISO_IEC_8859_6 = 8; // Latin/Arabic |
|
34 | + public const ISO_IEC_8859_7 = 9; // Latin/Greek |
|
35 | 35 | public const ISO_IEC_8859_8 = 10; // Latin/Hebrew |
36 | 36 | public const ISO_IEC_8859_9 = 11; // Latin-5 |
37 | 37 | public const ISO_IEC_8859_10 = 12; // Latin-6 |