($class, $spec, $input)
| 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 | { |
no test coverage detected