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

Method _readList

lib/php/src/Thrift.php:518–571  ·  view source on GitHub ↗
(&$var, $spec, $input, $set=false)

Source from the content-addressed store, hash-verified

516 }
517
518 private function _readList(&$var, $spec, $input, $set=false)
519 {
520 $xfer = 0;
521 $etype = $spec['etype'];
522 $eread = $vread = null;
523 if (isset(TBase::$tmethod[$etype])) {
524 $eread = 'read'.TBase::$tmethod[$etype];
525 } else {
526 $espec = $spec['elem'];
527 }
528 $var = array();
529 $_etype = $size = 0;
530 if ($set) {
531 $xfer += $input->readSetBegin($_etype, $size);
532 } else {
533 $xfer += $input->readListBegin($_etype, $size);
534 }
535 for ($i = 0; $i < $size; ++$i) {
536 $elem = null;
537 if ($eread !== null) {
538 $xfer += $input->$eread($elem);
539 } else {
540 $espec = $spec['elem'];
541 switch ($etype) {
542 case TType::STRUCT:
543 $class = $espec['class'];
544 $elem = new $class();
545 $xfer += $elem->read($input);
546 break;
547 case TType::MAP:
548 $xfer += $this->_readMap($elem, $espec, $input);
549 break;
550 case TType::LST:
551 $xfer += $this->_readList($elem, $espec, $input, false);
552 break;
553 case TType::SET:
554 $xfer += $this->_readList($elem, $espec, $input, true);
555 break;
556 }
557 }
558 if ($set) {
559 $var[$elem] = true;
560 } else {
561 $var []= $elem;
562 }
563 }
564 if ($set) {
565 $xfer += $input->readSetEnd();
566 } else {
567 $xfer += $input->readListEnd();
568 }
569
570 return $xfer;
571 }
572
573 protected function _read($class, $spec, $input)
574 {

Callers 2

_readMapMethod · 0.95
_readMethod · 0.95

Calls 6

_readMapMethod · 0.95
readSetBeginMethod · 0.65
readListBeginMethod · 0.65
readMethod · 0.65
readSetEndMethod · 0.65
readListEndMethod · 0.65

Tested by

no test coverage detected