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

Method eatNum

text-to-qr/lib/phpqrcode/qrsplit.php:93–127  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

91
92 //----------------------------------------------------------------------
93 public function eatNum()
94 {
95 $ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
96
97 $p = 0;
98 while(self::isdigitat($this->dataStr, $p)) {
99 $p++;
100 }
101
102 $run = $p;
103 $mode = $this->identifyMode($p);
104
105 if($mode == QR_MODE_8) {
106 $dif = QRinput::estimateBitsModeNum($run) + 4 + $ln
107 + QRinput::estimateBitsMode8(1) // + 4 + l8
108 - QRinput::estimateBitsMode8($run + 1); // - 4 - l8
109 if($dif > 0) {
110 return $this->eat8();
111 }
112 }
113 if($mode == QR_MODE_AN) {
114 $dif = QRinput::estimateBitsModeNum($run) + 4 + $ln
115 + QRinput::estimateBitsModeAn(1) // + 4 + la
116 - QRinput::estimateBitsModeAn($run + 1);// - 4 - la
117 if($dif > 0) {
118 return $this->eatAn();
119 }
120 }
121
122 $ret = $this->input->append(QR_MODE_NUM, $run, str_split($this->dataStr));
123 if($ret < 0)
124 return -1;
125
126 return $run;
127 }
128
129 //----------------------------------------------------------------------
130 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