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

Method _write

lib/php/src/Thrift.php:729–764  ·  view source on GitHub ↗
($class, $spec, $output)

Source from the content-addressed store, hash-verified

727 }
728
729 protected function _write($class, $spec, $output)
730 {
731 $xfer = 0;
732 $xfer += $output->writeStructBegin($class);
733 foreach ($spec as $fid => $fspec) {
734 $var = $fspec['var'];
735 if ($this->$var !== null) {
736 $ftype = $fspec['type'];
737 $xfer += $output->writeFieldBegin($var, $ftype, $fid);
738 if (isset(TBase::$tmethod[$ftype])) {
739 $func = 'write'.TBase::$tmethod[$ftype];
740 $xfer += $output->$func($this->$var);
741 } else {
742 switch ($ftype) {
743 case TType::STRUCT:
744 $xfer += $this->$var->write($output);
745 break;
746 case TType::MAP:
747 $xfer += $this->_writeMap($this->$var, $fspec, $output);
748 break;
749 case TType::LST:
750 $xfer += $this->_writeList($this->$var, $fspec, $output, false);
751 break;
752 case TType::SET:
753 $xfer += $this->_writeList($this->$var, $fspec, $output, true);
754 break;
755 }
756 }
757 $xfer += $output->writeFieldEnd();
758 }
759 }
760 $xfer += $output->writeFieldStop();
761 $xfer += $output->writeStructEnd();
762
763 return $xfer;
764 }
765}
766
767class TApplicationException extends TException

Callers

nothing calls this directly

Calls 8

_writeMapMethod · 0.95
_writeListMethod · 0.95
writeStructBeginMethod · 0.65
writeFieldBeginMethod · 0.65
writeMethod · 0.65
writeFieldEndMethod · 0.65
writeFieldStopMethod · 0.65
writeStructEndMethod · 0.65

Tested by

no test coverage detected