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

Method _read

lib/php/src/Thrift.php:573–622  ·  view source on GitHub ↗
($class, $spec, $input)

Source from the content-addressed store, hash-verified

571 }
572
573 protected function _read($class, $spec, $input)
574 {
575 $xfer = 0;
576 $fname = null;
577 $ftype = 0;
578 $fid = 0;
579 $xfer += $input->readStructBegin($fname);
580 while (true) {
581 $xfer += $input->readFieldBegin($fname, $ftype, $fid);
582 if ($ftype == TType::STOP) {
583 break;
584 }
585 if (isset($spec[$fid])) {
586 $fspec = $spec[$fid];
587 $var = $fspec['var'];
588 if ($ftype == $fspec['type']) {
589 $xfer = 0;
590 if (isset(TBase::$tmethod[$ftype])) {
591 $func = 'read'.TBase::$tmethod[$ftype];
592 $xfer += $input->$func($this->$var);
593 } else {
594 switch ($ftype) {
595 case TType::STRUCT:
596 $class = $fspec['class'];
597 $this->$var = new $class();
598 $xfer += $this->$var->read($input);
599 break;
600 case TType::MAP:
601 $xfer += $this->_readMap($this->$var, $fspec, $input);
602 break;
603 case TType::LST:
604 $xfer += $this->_readList($this->$var, $fspec, $input, false);
605 break;
606 case TType::SET:
607 $xfer += $this->_readList($this->$var, $fspec, $input, true);
608 break;
609 }
610 }
611 } else {
612 $xfer += $input->skip($ftype);
613 }
614 } else {
615 $xfer += $input->skip($ftype);
616 }
617 $xfer += $input->readFieldEnd();
618 }
619 $xfer += $input->readStructEnd();
620
621 return $xfer;
622 }
623
624 private function _writeMap($var, $spec, $output)
625 {

Callers 1

readMethod · 0.45

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