----------------------------------------------------------------------
()
| 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() |
no test coverage detected