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

Method _write

lib/php/lib/Exception/TException.php:349–384  ·  view source on GitHub ↗
($class, $spec, $output)

Source from the content-addressed store, hash-verified

347 }
348
349 protected function _write($class, $spec, $output)
350 {
351 $xfer = 0;
352 $xfer += $output->writeStructBegin($class);
353 foreach ($spec as $fid => $fspec) {
354 $var = $fspec['var'];
355 if ($this->$var !== null) {
356 $ftype = $fspec['type'];
357 $xfer += $output->writeFieldBegin($var, $ftype, $fid);
358 if (isset(TBase::$tmethod[$ftype])) {
359 $func = 'write' . TBase::$tmethod[$ftype];
360 $xfer += $output->$func($this->$var);
361 } else {
362 switch ($ftype) {
363 case TType::STRUCT:
364 $xfer += $this->$var->write($output);
365 break;
366 case TType::MAP:
367 $xfer += $this->_writeMap($this->$var, $fspec, $output);
368 break;
369 case TType::LST:
370 $xfer += $this->_writeList($this->$var, $fspec, $output, false);
371 break;
372 case TType::SET:
373 $xfer += $this->_writeList($this->$var, $fspec, $output, true);
374 break;
375 }
376 }
377 $xfer += $output->writeFieldEnd();
378 }
379 }
380 $xfer += $output->writeFieldStop();
381 $xfer += $output->writeStructEnd();
382
383 return $xfer;
384 }
385}

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