Beispiel #1
0
 public function read(TProtocol $input)
 {
     $xfer = 0;
     $fname = null;
     $ftype = 0;
     $fid = 0;
     $xfer += $input->readStructBegin($fname);
     while (true) {
         $xfer += $input->readFieldBegin($fname, $ftype, $fid);
         if ($ftype == TType::STOP) {
             break;
         }
         if (!$fid && $fname !== null) {
             if (isset(self::$_TFIELDMAP[$fname])) {
                 $fid = self::$_TFIELDMAP[$fname];
                 $ftype = self::$_TSPEC[$fid]['type'];
             }
         }
         switch ($fid) {
             case 1:
                 if ($ftype == TType::I32) {
                     $xfer += $input->readI32($this->weeks);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 2:
                 if ($ftype == TType::STRING) {
                     $xfer += $input->readString($this->title);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 3:
                 if ($ftype == TType::I32) {
                     $xfer += $input->readI32($this->employer);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             default:
                 $xfer += $input->skip($ftype);
                 break;
         }
         $xfer += $input->readFieldEnd();
     }
     $xfer += $input->readStructEnd();
     return $xfer;
 }
Beispiel #2
0
 public function read(TProtocol $input)
 {
     $xfer = 0;
     $fname = null;
     $ftype = 0;
     $fid = 0;
     $xfer += $input->readStructBegin($fname);
     while (true) {
         $xfer += $input->readFieldBegin($fname, $ftype, $fid);
         if ($ftype == TType::STOP) {
             break;
         }
         if (!$fid && $fname !== null) {
             if (isset(self::$_TFIELDMAP[$fname])) {
                 $fid = self::$_TFIELDMAP[$fname];
                 $ftype = self::$_TSPEC[$fid]['type'];
             }
         }
         switch ($fid) {
             case 1:
                 if ($ftype == TType::I64) {
                     $xfer += $input->readI64($this->id);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 2:
                 if ($ftype == TType::STRING) {
                     $xfer += $input->readString($this->name);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 3:
                 if ($ftype == TType::I16) {
                     $xfer += $input->readI16($this->age);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 4:
                 if ($ftype == TType::STRING) {
                     $xfer += $input->readString($this->address);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 5:
                 if ($ftype == TType::STRUCT) {
                     $this->favoriteColor = new Color();
                     $xfer += $this->favoriteColor->read($input);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 6:
                 if ($ftype == TType::SET) {
                     $this->friends = array();
                     $_size0 = 0;
                     $_etype3 = 0;
                     $xfer += $input->readSetBegin($_etype3, $_size0);
                     for ($_i4 = 0; $_size0 === null || $_i4 < $_size0; ++$_i4) {
                         if ($_size0 === null && !$input->readSetHasNext()) {
                             break;
                         }
                         $elem5 = null;
                         $xfer += $input->readI64($elem5);
                         $this->friends[$elem5] = true;
                     }
                     $xfer += $input->readSetEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 7:
                 if ($ftype == TType::I64) {
                     $xfer += $input->readI64($this->bestFriend);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 8:
                 if ($ftype == TType::MAP) {
                     $this->petNames = array();
                     $_size6 = 0;
                     $_ktype7 = 0;
                     $_vtype8 = 0;
                     $xfer += $input->readMapBegin($_ktype7, $_vtype8, $_size6);
                     for ($_i10 = 0; $_size6 === null || $_i10 < $_size6; ++$_i10) {
                         if ($_size6 === null && !$input->readMapHasNext()) {
                             break;
                         }
                         $key11 = 0;
                         $val12 = '';
                         $xfer += $input->readI32($key11);
                         $xfer += $input->readString($val12);
                         $this->petNames[$key11] = $val12;
                     }
                     $xfer += $input->readMapEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 9:
                 if ($ftype == TType::I32) {
                     $xfer += $input->readI32($this->afraidOfAnimal);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 10:
                 if ($ftype == TType::LST) {
                     $this->vehicles = array();
                     $_size13 = 0;
                     $_etype16 = 0;
                     $xfer += $input->readListBegin($_etype16, $_size13);
                     for ($_i17 = 0; $_size13 === null || $_i17 < $_size13; ++$_i17) {
                         if ($_size13 === null && !$input->readListHasNext()) {
                             break;
                         }
                         $elem18 = null;
                         $elem18 = new Vehicle();
                         $xfer += $elem18->read($input);
                         $this->vehicles[] = $elem18;
                     }
                     $xfer += $input->readListEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             default:
                 $xfer += $input->skip($ftype);
                 break;
         }
         $xfer += $input->readFieldEnd();
     }
     $xfer += $input->readStructEnd();
     return $xfer;
 }
Beispiel #3
0
 public function read(TProtocol $input)
 {
     $xfer = 0;
     $fname = null;
     $ftype = 0;
     $fid = 0;
     $xfer += $input->readStructBegin($fname);
     while (true) {
         $xfer += $input->readFieldBegin($fname, $ftype, $fid);
         if ($ftype == TType::STOP) {
             break;
         }
         if (!$fid && $fname !== null) {
             if (isset(self::$_TFIELDMAP[$fname])) {
                 $fid = self::$_TFIELDMAP[$fname];
                 $ftype = self::$_TSPEC[$fid]['type'];
             }
         }
         switch ($fid) {
             case 1:
                 if ($ftype == TType::I32) {
                     $xfer += $input->readI32($this->min);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 2:
                 if ($ftype == TType::I32) {
                     $xfer += $input->readI32($this->max);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             default:
                 $xfer += $input->skip($ftype);
                 break;
         }
         $xfer += $input->readFieldEnd();
     }
     $xfer += $input->readStructEnd();
     if (!isset($this->min)) {
         throw new TProtocolException("Required field 'min' was not found in serialized data! Struct: Range", TProtocolException::MISSING_REQUIRED_FIELD);
     }
     if (!isset($this->max)) {
         throw new TProtocolException("Required field 'max' was not found in serialized data! Struct: Range", TProtocolException::MISSING_REQUIRED_FIELD);
     }
     return $xfer;
 }