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

Method eatAn

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

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

()

Source from the content-addressed store, hash-verified

2065
2066 //----------------------------------------------------------------------
2067 public function eatAn()
2068 {
2069 $la = QRspec::lengthIndicator(QR_MODE_AN, $this->input->getVersion());
2070 $ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
2071
2072 $p = 0;
2073
2074 while(self::isalnumat($this->dataStr, $p)) {
2075 if(self::isdigitat($this->dataStr, $p)) {
2076 $q = $p;
2077 while(self::isdigitat($this->dataStr, $q)) {
2078 $q++;
2079 }
2080
2081 $dif = QRinput::estimateBitsModeAn($p) // + 4 + la
2082 + QRinput::estimateBitsModeNum($q - $p) + 4 + $ln
2083 - QRinput::estimateBitsModeAn($q); // - 4 - la
2084
2085 if($dif < 0) {
2086 break;
2087 } else {
2088 $p = $q;
2089 }
2090 } else {
2091 $p++;
2092 }
2093 }
2094
2095 $run = $p;
2096
2097 if(!self::isalnumat($this->dataStr, $p)) {
2098 $dif = QRinput::estimateBitsModeAn($run) + 4 + $la
2099 + QRinput::estimateBitsMode8(1) // + 4 + l8
2100 - QRinput::estimateBitsMode8($run + 1); // - 4 - l8
2101 if($dif > 0) {
2102 return $this->eat8();
2103 }
2104 }
2105
2106 $ret = $this->input->append(QR_MODE_AN, $run, str_split($this->dataStr));
2107 if($ret < 0)
2108 return -1;
2109
2110 return $run;
2111 }
2112
2113 //----------------------------------------------------------------------
2114 public function eatKanji()

Callers 2

eatNumMethod · 0.95
splitStringMethod · 0.95

Calls 10

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

Tested by

no test coverage detected