MCPcopy Create free account
hub / github.com/codemistic/Web-Development / encodeModeAn

Method encodeModeAn

text-to-qr/lib/phpqrcode/phpqrcode.php:1107–1134  ·  view source on GitHub ↗

----------------------------------------------------------------------

($version)

Source from the content-addressed store, hash-verified

1105
1106 //----------------------------------------------------------------------
1107 public function encodeModeAn($version)
1108 {
1109 try {
1110 $words = (int)($this->size / 2);
1111 $bs = new QRbitstream();
1112
1113 $bs->appendNum(4, 0x02);
1114 $bs->appendNum(QRspec::lengthIndicator(QR_MODE_AN, $version), $this->size);
1115
1116 for($i=0; $i<$words; $i++) {
1117 $val = (int)QRinput::lookAnTable(ord($this->data[$i*2 ])) * 45;
1118 $val += (int)QRinput::lookAnTable(ord($this->data[$i*2+1]));
1119
1120 $bs->appendNum(11, $val);
1121 }
1122
1123 if($this->size & 1) {
1124 $val = QRinput::lookAnTable(ord($this->data[$words * 2]));
1125 $bs->appendNum(6, $val);
1126 }
1127
1128 $this->bstream = $bs;
1129 return 0;
1130
1131 } catch (Exception $e) {
1132 return -1;
1133 }
1134 }
1135
1136 //----------------------------------------------------------------------
1137 public function encodeMode8($version)

Callers 1

encodeBitStreamMethod · 0.95

Calls 3

appendNumMethod · 0.45
lengthIndicatorMethod · 0.45
lookAnTableMethod · 0.45

Tested by

no test coverage detected