| Conditions | 7 |
| Paths | 7 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | protected function write(string $data):void{ |
||
| 39 | $len = strlen($data); |
||
| 40 | |||
| 41 | for($i = 0; $i + 1 < $len; $i += 2){ |
||
| 42 | $c = ((0xff & ord($data[$i])) << 8) | (0xff & ord($data[$i + 1])); |
||
| 43 | |||
| 44 | if(0x8140 <= $c && $c <= 0x9FFC){ |
||
| 45 | $c -= 0x8140; |
||
| 46 | } |
||
| 47 | elseif(0xE040 <= $c && $c <= 0xEBBF){ |
||
| 48 | $c -= 0xC140; |
||
| 49 | } |
||
| 50 | else{ |
||
| 51 | throw new QRCodeDataException(sprintf('illegal char at %d [%d]', $i + 1, $c)); |
||
| 52 | } |
||
| 53 | |||
| 54 | $this->bitBuffer->put((($c >> 8) & 0xff) * 0xC0 + ($c & 0xff), 13); |
||
| 55 | |||
| 56 | } |
||
| 57 | |||
| 58 | if($i < $len){ |
||
| 59 | throw new QRCodeDataException(sprintf('illegal char at %d', $i + 1)); |
||
| 60 | } |
||
| 65 |