@@ -116,7 +116,7 @@ |
||
116 | 116 | |
117 | 117 | // scale down to the expected size |
118 | 118 | if($this->options->drawCircularModules && $this->options->scale <= 20){ |
119 | - $this->image = imagescale($this->image, $this->length/10, $this->length/10, IMG_BILINEAR_FIXED); |
|
119 | + $this->image = imagescale($this->image, $this->length / 10, $this->length / 10, IMG_BILINEAR_FIXED); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | if($this->options->returnResource){ |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @see \chillerlan\QRCode\Common\Version::AUTO |
34 | 34 | * @var int |
35 | 35 | */ |
36 | - public const VERSION_AUTO = Version::AUTO; |
|
36 | + public const VERSION_AUTO = Version::AUTO; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * @deprecated 5.0.0 use MaskPattern::AUTO instead |
@@ -82,28 +82,28 @@ discard block |
||
82 | 82 | * @see \chillerlan\QRCode\Output\QROutputInterface::MARKUP_SVG |
83 | 83 | * @var string |
84 | 84 | */ |
85 | - public const OUTPUT_MARKUP_SVG = QROutputInterface::MARKUP_SVG; |
|
85 | + public const OUTPUT_MARKUP_SVG = QROutputInterface::MARKUP_SVG; |
|
86 | 86 | |
87 | 87 | /** |
88 | 88 | * @deprecated 5.0.0 use QROutputInterface::GDIMAGE_PNG instead |
89 | 89 | * @see \chillerlan\QRCode\Output\QROutputInterface::GDIMAGE_PNG |
90 | 90 | * @var string |
91 | 91 | */ |
92 | - public const OUTPUT_IMAGE_PNG = QROutputInterface::GDIMAGE_PNG; |
|
92 | + public const OUTPUT_IMAGE_PNG = QROutputInterface::GDIMAGE_PNG; |
|
93 | 93 | |
94 | 94 | /** |
95 | 95 | * @deprecated 5.0.0 use QROutputInterface::GDIMAGE_JPG instead |
96 | 96 | * @see \chillerlan\QRCode\Output\QROutputInterface::GDIMAGE_JPG |
97 | 97 | * @var string |
98 | 98 | */ |
99 | - public const OUTPUT_IMAGE_JPG = QROutputInterface::GDIMAGE_JPG; |
|
99 | + public const OUTPUT_IMAGE_JPG = QROutputInterface::GDIMAGE_JPG; |
|
100 | 100 | |
101 | 101 | /** |
102 | 102 | * @deprecated 5.0.0 use QROutputInterface::GDIMAGE_GIF instead |
103 | 103 | * @see \chillerlan\QRCode\Output\QROutputInterface::GDIMAGE_GIF |
104 | 104 | * @var string |
105 | 105 | */ |
106 | - public const OUTPUT_IMAGE_GIF = QROutputInterface::GDIMAGE_GIF; |
|
106 | + public const OUTPUT_IMAGE_GIF = QROutputInterface::GDIMAGE_GIF; |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * @deprecated 5.0.0 use QROutputInterface::STRING_JSON instead |
@@ -124,35 +124,35 @@ discard block |
||
124 | 124 | * @see \chillerlan\QRCode\Output\QROutputInterface::IMAGICK |
125 | 125 | * @var string |
126 | 126 | */ |
127 | - public const OUTPUT_IMAGICK = QROutputInterface::IMAGICK; |
|
127 | + public const OUTPUT_IMAGICK = QROutputInterface::IMAGICK; |
|
128 | 128 | |
129 | 129 | /** |
130 | 130 | * @deprecated 5.0.0 use QROutputInterface::FPDF instead |
131 | 131 | * @see \chillerlan\QRCode\Output\QROutputInterface::FPDF |
132 | 132 | * @var string |
133 | 133 | */ |
134 | - public const OUTPUT_FPDF = QROutputInterface::FPDF; |
|
134 | + public const OUTPUT_FPDF = QROutputInterface::FPDF; |
|
135 | 135 | |
136 | 136 | /** |
137 | 137 | * @deprecated 5.0.0 use QROutputInterface::EPS instead |
138 | 138 | * @see \chillerlan\QRCode\Output\QROutputInterface::EPS |
139 | 139 | * @var string |
140 | 140 | */ |
141 | - public const OUTPUT_EPS = QROutputInterface::EPS; |
|
141 | + public const OUTPUT_EPS = QROutputInterface::EPS; |
|
142 | 142 | |
143 | 143 | /** |
144 | 144 | * @deprecated 5.0.0 use QROutputInterface::CUSTOM instead |
145 | 145 | * @see \chillerlan\QRCode\Output\QROutputInterface::CUSTOM |
146 | 146 | * @var string |
147 | 147 | */ |
148 | - public const OUTPUT_CUSTOM = QROutputInterface::CUSTOM; |
|
148 | + public const OUTPUT_CUSTOM = QROutputInterface::CUSTOM; |
|
149 | 149 | |
150 | 150 | /** |
151 | 151 | * @deprecated 5.0.0 use QROutputInterface::MODES instead |
152 | 152 | * @see \chillerlan\QRCode\Output\QROutputInterface::MODES |
153 | 153 | * @var string[] |
154 | 154 | */ |
155 | - public const OUTPUT_MODES = QROutputInterface::MODES; |
|
155 | + public const OUTPUT_MODES = QROutputInterface::MODES; |
|
156 | 156 | |
157 | 157 | /** |
158 | 158 | * The settings container |
@@ -37,46 +37,46 @@ discard block |
||
37 | 37 | */ |
38 | 38 | private const MAX_BITS = [ |
39 | 39 | // [ L, M, Q, H] // v => modules |
40 | - [ null, null, null, null], // 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 | + [null, null, null, null], // 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 |
||
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 |
||
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 |
||
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 |
||
118 | 118 | 0b010111011011010, |
119 | 119 | 0b010101111101101, |
120 | 120 | ], |
121 | - [ // H |
|
121 | + [// H |
|
122 | 122 | 0b001011010001001, |
123 | 123 | 0b001001110111110, |
124 | 124 | 0b001110011100111, |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function __construct(int $eccLevel){ |
149 | 149 | |
150 | - if((0b11 & $eccLevel) !== $eccLevel){ |
|
150 | + if((0b11&$eccLevel) !== $eccLevel){ |
|
151 | 151 | throw new QRCodeException('invalid ECC level'); |
152 | 152 | } |
153 | 153 |
@@ -70,7 +70,7 @@ |
||
70 | 70 | * @return string|\Imagick |
71 | 71 | */ |
72 | 72 | public function dump(string $file = null){ |
73 | - $file ??= $this->options->cachefile; |
|
73 | + $file ??= $this->options->cachefile; |
|
74 | 74 | $this->imagick = new Imagick; |
75 | 75 | |
76 | 76 | $bgColor = $this->options->imageTransparent ? 'transparent' : 'white'; |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | */ |
398 | 398 | protected function set_eccLevel(int $eccLevel):void{ |
399 | 399 | |
400 | - if((0b11 & $eccLevel) !== $eccLevel){ |
|
400 | + if((0b11&$eccLevel) !== $eccLevel){ |
|
401 | 401 | throw new QRCodeException(sprintf('Invalid error correct level: %s', $eccLevel)); |
402 | 402 | } |
403 | 403 | |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | /** |
481 | 481 | * clamp the logo space values between 0 and maximum length (177 modules at version 40) |
482 | 482 | */ |
483 | - protected function clampLogoSpaceValue(?int $value):?int{ |
|
483 | + protected function clampLogoSpaceValue(?int $value): ?int{ |
|
484 | 484 | |
485 | 485 | if($value === null){ |
486 | 486 | return null; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $byte2 = ord($string[$i + 1]); |
92 | 92 | |
93 | 93 | // byte 1 unused and vendor ranges |
94 | - if($byte1 < 0x81 || ($byte1 > 0x84 && $byte1 < 0x88) || ($byte1 > 0x9f && $byte1 < 0xe0) || $byte1 > 0xea){ |
|
94 | + if($byte1 < 0x81 || ($byte1 > 0x84 && $byte1 < 0x88) || ($byte1 > 0x9f && $byte1 < 0xe0) || $byte1 > 0xea){ |
|
95 | 95 | return false; |
96 | 96 | } |
97 | 97 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $len = strlen($this->data); |
137 | 137 | |
138 | 138 | for($i = 0; $i + 1 < $len; $i += 2){ |
139 | - $c = ((0xff & ord($this->data[$i])) << 8) | (0xff & ord($this->data[$i + 1])); |
|
139 | + $c = ((0xff & ord($this->data[$i])) << 8)|(0xff & ord($this->data[$i + 1])); |
|
140 | 140 | |
141 | 141 | if($c >= 0x8140 && $c <= 0x9ffc){ |
142 | 142 | $c -= 0x8140; |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $length = $bitBuffer->read(self::getLengthBits($versionNumber)); |
167 | 167 | |
168 | 168 | if($bitBuffer->available() < $length * 13){ |
169 | - throw new QRCodeDataException('not enough bits available'); // @codeCoverageIgnore |
|
169 | + throw new QRCodeDataException('not enough bits available'); // @codeCoverageIgnore |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | // Each character will require 2 bytes. Read the characters as 2-byte pairs and decode as SJIS afterwards |
@@ -176,15 +176,15 @@ discard block |
||
176 | 176 | while($length > 0){ |
177 | 177 | // Each 13 bits encodes a 2-byte character |
178 | 178 | $twoBytes = $bitBuffer->read(13); |
179 | - $assembledTwoBytes = ((int)($twoBytes / 0x0c0) << 8) | ($twoBytes % 0x0c0); |
|
179 | + $assembledTwoBytes = ((int)($twoBytes / 0x0c0) << 8)|($twoBytes % 0x0c0); |
|
180 | 180 | |
181 | 181 | $assembledTwoBytes += ($assembledTwoBytes < 0x01f00) |
182 | 182 | ? 0x08140 // In the 0x8140 to 0x9FFC range |
183 | 183 | : 0x0c140; // In the 0xE040 to 0xEBBF range |
184 | 184 | |
185 | 185 | $buffer[$offset] = chr(0xff & ($assembledTwoBytes >> 8)); |
186 | - $buffer[$offset + 1] = chr(0xff & $assembledTwoBytes); |
|
187 | - $offset += 2; |
|
186 | + $buffer[$offset + 1] = chr(0xff&$assembledTwoBytes); |
|
187 | + $offset += 2; |
|
188 | 188 | $length--; |
189 | 189 | } |
190 | 190 |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $len = strlen($this->data); |
122 | 122 | |
123 | 123 | for($i = 0; $i + 1 < $len; $i += 2){ |
124 | - $c = ((0xff & ord($this->data[$i])) << 8) | (0xff & ord($this->data[$i + 1])); |
|
124 | + $c = ((0xff & ord($this->data[$i])) << 8)|(0xff & ord($this->data[$i + 1])); |
|
125 | 125 | |
126 | 126 | if($c >= 0xa1a1 && $c <= 0xaafe){ |
127 | 127 | $c -= 0x0a1a1; |
@@ -161,15 +161,15 @@ discard block |
||
161 | 161 | while($length > 0){ |
162 | 162 | // Each 13 bits encodes a 2-byte character |
163 | 163 | $twoBytes = $bitBuffer->read(13); |
164 | - $assembledTwoBytes = (($twoBytes / 0x060) << 8) | ($twoBytes % 0x060); |
|
164 | + $assembledTwoBytes = (($twoBytes / 0x060) << 8)|($twoBytes % 0x060); |
|
165 | 165 | |
166 | 166 | $assembledTwoBytes += ($assembledTwoBytes < 0x00a00) // 0x003BF |
167 | 167 | ? 0x0a1a1 // In the 0xA1A1 to 0xAAFE range |
168 | 168 | : 0x0a6a1; // In the 0xB0A1 to 0xFAFE range |
169 | 169 | |
170 | 170 | $buffer[$offset] = chr(0xff & ($assembledTwoBytes >> 8)); |
171 | - $buffer[$offset + 1] = chr(0xff & $assembledTwoBytes); |
|
172 | - $offset += 2; |
|
171 | + $buffer[$offset + 1] = chr(0xff&$assembledTwoBytes); |
|
172 | + $offset += 2; |
|
173 | 173 | $length--; |
174 | 174 | } |
175 | 175 |
@@ -330,7 +330,7 @@ discard block |
||
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 |
||
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 |
@@ -58,7 +58,7 @@ discard block |
||
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 = []; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * |
175 | 175 | * @return \chillerlan\QRCode\Detector\AlignmentPattern|null if we have found the same pattern twice, or null if not |
176 | 176 | */ |
177 | - private function handlePossibleCenter(array $stateCount, int $i, int $j):?AlignmentPattern{ |
|
177 | + private function handlePossibleCenter(array $stateCount, int $i, int $j): ?AlignmentPattern{ |
|
178 | 178 | $stateCountTotal = $stateCount[0] + $stateCount[1] + $stateCount[2]; |
179 | 179 | $centerJ = $this->centerFromEnd($stateCount, $j); |
180 | 180 | $centerI = $this->crossCheckVertical($i, (int)$centerJ, 2 * $stateCount[1], $stateCountTotal); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * |
224 | 224 | * @return float|null vertical center of alignment pattern, or null if not found |
225 | 225 | */ |
226 | - private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal):?float{ |
|
226 | + private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal): ?float{ |
|
227 | 227 | $maxI = $this->matrix->size(); |
228 | 228 | $stateCount = []; |
229 | 229 | $stateCount[0] = 0; |