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

Method encodeModeAn

text-to-qr/lib/phpqrcode/qrinput.php:94–121  ·  view source on GitHub ↗

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

($version)

Source from the content-addressed store, hash-verified

92
93 //----------------------------------------------------------------------
94 public function encodeModeAn($version)
95 {
96 try {
97 $words = (int)($this->size / 2);
98 $bs = new QRbitstream();
99
100 $bs->appendNum(4, 0x02);
101 $bs->appendNum(QRspec::lengthIndicator(QR_MODE_AN, $version), $this->size);
102
103 for($i=0; $i<$words; $i++) {
104 $val = (int)QRinput::lookAnTable(ord($this->data[$i*2 ])) * 45;
105 $val += (int)QRinput::lookAnTable(ord($this->data[$i*2+1]));
106
107 $bs->appendNum(11, $val);
108 }
109
110 if($this->size & 1) {
111 $val = QRinput::lookAnTable(ord($this->data[$words * 2]));
112 $bs->appendNum(6, $val);
113 }
114
115 $this->bstream = $bs;
116 return 0;
117
118 } catch (Exception $e) {
119 return -1;
120 }
121 }
122
123 //----------------------------------------------------------------------
124 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