|
@@ -91,7 +91,7 @@ discard block |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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
|
|