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

Method eatNum

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

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

()

Source from the content-addressed store, hash-verified

2028
2029 //----------------------------------------------------------------------
2030 public function eatNum()
2031 {
2032 $ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
2033
2034 $p = 0;
2035 while(self::isdigitat($this->dataStr, $p)) {
2036 $p++;
2037 }
2038
2039 $run = $p;
2040 $mode = $this->identifyMode($p);
2041
2042 if($mode == QR_MODE_8) {
2043 $dif = QRinput::estimateBitsModeNum($run) + 4 + $ln
2044 + QRinput::estimateBitsMode8(1) // + 4 + l8
2045 - QRinput::estimateBitsMode8($run + 1); // - 4 - l8
2046 if($dif > 0) {
2047 return $this->eat8();
2048 }
2049 }
2050 if($mode == QR_MODE_AN) {
2051 $dif = QRinput::estimateBitsModeNum($run) + 4 + $ln
2052 + QRinput::estimateBitsModeAn(1) // + 4 + la
2053 - QRinput::estimateBitsModeAn($run + 1);// - 4 - la
2054 if($dif > 0) {
2055 return $this->eatAn();
2056 }
2057 }
2058
2059 $ret = $this->input->append(QR_MODE_NUM, $run, str_split($this->dataStr));
2060 if($ret < 0)
2061 return -1;
2062
2063 return $run;
2064 }
2065
2066 //----------------------------------------------------------------------
2067 public function eatAn()

Callers 1

splitStringMethod · 0.95

Calls 11

isdigitatMethod · 0.95
identifyModeMethod · 0.95
eat8Method · 0.95
eatAnMethod · 0.95
str_splitFunction · 0.85
lengthIndicatorMethod · 0.45
getVersionMethod · 0.45
estimateBitsModeNumMethod · 0.45
estimateBitsMode8Method · 0.45
estimateBitsModeAnMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected