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

Method eat8

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

* eat8 * @return int run */

()

Source from the content-addressed store, hash-verified

1407 * @return int run
1408 */
1409 protected function eat8() {
1410 $la = $this->lengthIndicator(QR_MODE_AN, $this->version);
1411 $ln = $this->lengthIndicator(QR_MODE_NM, $this->version);
1412 $p = 1;
1413 $dataStrLen = strlen($this->dataStr);
1414 while($p < $dataStrLen) {
1415 $mode = $this->identifyMode($p);
1416 if ($mode == QR_MODE_KJ) {
1417 break;
1418 }
1419 if ($mode == QR_MODE_NM) {
1420 $q = $p;
1421 while($this->isdigitat($this->dataStr, $q)) {
1422 $q++;
1423 }
1424 $dif = $this->estimateBitsMode8($p) // + 4 + l8
1425 + $this->estimateBitsModeNum($q - $p) + 4 + $ln
1426 - $this->estimateBitsMode8($q); // - 4 - l8
1427 if ($dif < 0) {
1428 break;
1429 } else {
1430 $p = $q;
1431 }
1432 } elseif ($mode == QR_MODE_AN) {
1433 $q = $p;
1434 while($this->isalnumat($this->dataStr, $q)) {
1435 $q++;
1436 }
1437 $dif = $this->estimateBitsMode8($p) // + 4 + l8
1438 + $this->estimateBitsModeAn($q - $p) + 4 + $la
1439 - $this->estimateBitsMode8($q); // - 4 - l8
1440 if ($dif < 0) {
1441 break;
1442 } else {
1443 $p = $q;
1444 }
1445 } else {
1446 $p++;
1447 }
1448 }
1449 $run = $p;
1450 $this->items = $this->appendNewInputItem($this->items, QR_MODE_8B, $run, str_split($this->dataStr));
1451 return $run;
1452 }
1453
1454 /**
1455 * splitString

Callers 3

eatNumMethod · 0.95
eatAnMethod · 0.95
splitStringMethod · 0.95

Calls 9

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

Tested by

no test coverage detected