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

Method eatAn

text-to-qr/lib/phpqrcode/bindings/tcpdf/qrcode.php:1357–1390  ·  view source on GitHub ↗

* eatAn * @return int run */

()

Source from the content-addressed store, hash-verified

1355 * @return int run
1356 */
1357 protected function eatAn() {
1358 $la = $this->lengthIndicator(QR_MODE_AN, $this->version);
1359 $ln = $this->lengthIndicator(QR_MODE_NM, $this->version);
1360 $p = 0;
1361 while($this->isalnumat($this->dataStr, $p)) {
1362 if ($this->isdigitat($this->dataStr, $p)) {
1363 $q = $p;
1364 while($this->isdigitat($this->dataStr, $q)) {
1365 $q++;
1366 }
1367 $dif = $this->estimateBitsModeAn($p) // + 4 + la
1368 + $this->estimateBitsModeNum($q - $p) + 4 + $ln
1369 - $this->estimateBitsModeAn($q); // - 4 - la
1370 if ($dif < 0) {
1371 break;
1372 } else {
1373 $p = $q;
1374 }
1375 } else {
1376 $p++;
1377 }
1378 }
1379 $run = $p;
1380 if (!$this->isalnumat($this->dataStr, $p)) {
1381 $dif = $this->estimateBitsModeAn($run) + 4 + $la
1382 + $this->estimateBitsMode8(1) // + 4 + l8
1383 - $this->estimateBitsMode8($run + 1); // - 4 - l8
1384 if ($dif > 0) {
1385 return $this->eat8();
1386 }
1387 }
1388 $this->items = $this->appendNewInputItem($this->items, QR_MODE_AN, $run, str_split($this->dataStr));
1389 return $run;
1390 }
1391
1392 /**
1393 * eatKanji

Callers 2

eatNumMethod · 0.95
splitStringMethod · 0.95

Calls 9

lengthIndicatorMethod · 0.95
isalnumatMethod · 0.95
isdigitatMethod · 0.95
estimateBitsModeAnMethod · 0.95
estimateBitsModeNumMethod · 0.95
estimateBitsMode8Method · 0.95
eat8Method · 0.95
appendNewInputItemMethod · 0.95
str_splitFunction · 0.85

Tested by

no test coverage detected