MCPcopy Create free account
hub / github.com/apache/thrift / _read

Method _read

lib/php/lib/Base/TBase.php:192–241  ·  view source on GitHub ↗
($class, $spec, $input)

Source from the content-addressed store, hash-verified

190 }
191
192 protected function _read($class, $spec, $input)
193 {
194 $xfer = 0;
195 $fname = null;
196 $ftype = 0;
197 $fid = 0;
198 $xfer += $input->readStructBegin($fname);
199 while (true) {
200 $xfer += $input->readFieldBegin($fname, $ftype, $fid);
201 if ($ftype == TType::STOP) {
202 break;
203 }
204 if (isset($spec[$fid])) {
205 $fspec = $spec[$fid];
206 $var = $fspec['var'];
207 if ($ftype == $fspec['type']) {
208 $xfer = 0;
209 if (isset(TBase::$tmethod[$ftype])) {
210 $func = 'read' . TBase::$tmethod[$ftype];
211 $xfer += $input->$func($this->$var);
212 } else {
213 switch ($ftype) {
214 case TType::STRUCT:
215 $class = $fspec['class'];
216 $this->$var = new $class();
217 $xfer += $this->$var->read($input);
218 break;
219 case TType::MAP:
220 $xfer += $this->_readMap($this->$var, $fspec, $input);
221 break;
222 case TType::LST:
223 $xfer += $this->_readList($this->$var, $fspec, $input, false);
224 break;
225 case TType::SET:
226 $xfer += $this->_readList($this->$var, $fspec, $input, true);
227 break;
228 }
229 }
230 } else {
231 $xfer += $input->skip($ftype);
232 }
233 } else {
234 $xfer += $input->skip($ftype);
235 }
236 $xfer += $input->readFieldEnd();
237 }
238 $xfer += $input->readStructEnd();
239
240 return $xfer;
241 }
242
243 private function _writeMap($var, $spec, $output)
244 {

Callers

nothing calls this directly

Calls 8

_readMapMethod · 0.95
_readListMethod · 0.95
readStructBeginMethod · 0.65
readFieldBeginMethod · 0.65
readMethod · 0.65
readFieldEndMethod · 0.65
readStructEndMethod · 0.65
skipMethod · 0.45

Tested by

no test coverage detected