Esempio n. 1
0
 public function read($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;
         }
         switch ($fid) {
             case 1:
                 if ($ftype == TType::STRING) {
                     $xfer += $input->readString($this->string_field);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 2:
                 if ($ftype == TType::SET) {
                     $this->set_field = array();
                     $_size16 = 0;
                     $_etype19 = 0;
                     $xfer += $input->readSetBegin($_etype19, $_size16);
                     for ($_i20 = 0; $_i20 < $_size16; ++$_i20) {
                         $elem21 = null;
                         $elem21 = new \ThriftTest\Insanity();
                         $xfer += $elem21->read($input);
                         if (is_scalar($elem21)) {
                             $this->set_field[$elem21] = true;
                         } else {
                             $this->set_field[] = $elem21;
                         }
                     }
                     $xfer += $input->readSetEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 3:
                 if ($ftype == TType::LST) {
                     $this->list_field = array();
                     $_size22 = 0;
                     $_etype25 = 0;
                     $xfer += $input->readListBegin($_etype25, $_size22);
                     for ($_i26 = 0; $_i26 < $_size22; ++$_i26) {
                         $elem27 = null;
                         $elem27 = array();
                         $_size28 = 0;
                         $_ktype29 = 0;
                         $_vtype30 = 0;
                         $xfer += $input->readMapBegin($_ktype29, $_vtype30, $_size28);
                         for ($_i32 = 0; $_i32 < $_size28; ++$_i32) {
                             $key33 = array();
                             $val34 = array();
                             $key33 = array();
                             $_size35 = 0;
                             $_etype38 = 0;
                             $xfer += $input->readSetBegin($_etype38, $_size35);
                             for ($_i39 = 0; $_i39 < $_size35; ++$_i39) {
                                 $elem40 = null;
                                 $xfer += $input->readI32($elem40);
                                 if (is_scalar($elem40)) {
                                     $key33[$elem40] = true;
                                 } else {
                                     $key33[] = $elem40;
                                 }
                             }
                             $xfer += $input->readSetEnd();
                             $val34 = array();
                             $_size41 = 0;
                             $_ktype42 = 0;
                             $_vtype43 = 0;
                             $xfer += $input->readMapBegin($_ktype42, $_vtype43, $_size41);
                             for ($_i45 = 0; $_i45 < $_size41; ++$_i45) {
                                 $key46 = 0;
                                 $val47 = array();
                                 $xfer += $input->readI32($key46);
                                 $val47 = array();
                                 $_size48 = 0;
                                 $_etype51 = 0;
                                 $xfer += $input->readSetBegin($_etype51, $_size48);
                                 for ($_i52 = 0; $_i52 < $_size48; ++$_i52) {
                                     $elem53 = null;
                                     $elem53 = array();
                                     $_size54 = 0;
                                     $_etype57 = 0;
                                     $xfer += $input->readListBegin($_etype57, $_size54);
                                     for ($_i58 = 0; $_i58 < $_size54; ++$_i58) {
                                         $elem59 = null;
                                         $elem59 = array();
                                         $_size60 = 0;
                                         $_ktype61 = 0;
                                         $_vtype62 = 0;
                                         $xfer += $input->readMapBegin($_ktype61, $_vtype62, $_size60);
                                         for ($_i64 = 0; $_i64 < $_size60; ++$_i64) {
                                             $key65 = new \ThriftTest\Insanity();
                                             $val66 = '';
                                             $key65 = new \ThriftTest\Insanity();
                                             $xfer += $key65->read($input);
                                             $xfer += $input->readString($val66);
                                             $elem59[$key65] = $val66;
                                         }
                                         $xfer += $input->readMapEnd();
                                         $elem53[] = $elem59;
                                     }
                                     $xfer += $input->readListEnd();
                                     if (is_scalar($elem53)) {
                                         $val47[$elem53] = true;
                                     } else {
                                         $val47[] = $elem53;
                                     }
                                 }
                                 $xfer += $input->readSetEnd();
                                 $val34[$key46] = $val47;
                             }
                             $xfer += $input->readMapEnd();
                             $elem27[$key33] = $val34;
                         }
                         $xfer += $input->readMapEnd();
                         $this->list_field[] = $elem27;
                     }
                     $xfer += $input->readListEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 4:
                 if ($ftype == TType::STRING) {
                     $xfer += $input->readString($this->binary_field);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             default:
                 $xfer += $input->skip($ftype);
                 break;
         }
         $xfer += $input->readFieldEnd();
     }
     $xfer += $input->readStructEnd();
     return $xfer;
 }
Esempio n. 2
0
 public function read($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;
         }
         switch ($fid) {
             case 0:
                 if ($ftype == TType::MAP) {
                     $this->success = array();
                     $_size349 = 0;
                     $_ktype350 = 0;
                     $_vtype351 = 0;
                     $xfer += $input->readMapBegin($_ktype350, $_vtype351, $_size349);
                     for ($_i353 = 0; $_i353 < $_size349; ++$_i353) {
                         $key354 = 0;
                         $val355 = array();
                         $xfer += $input->readI64($key354);
                         $val355 = array();
                         $_size356 = 0;
                         $_ktype357 = 0;
                         $_vtype358 = 0;
                         $xfer += $input->readMapBegin($_ktype357, $_vtype358, $_size356);
                         for ($_i360 = 0; $_i360 < $_size356; ++$_i360) {
                             $key361 = 0;
                             $val362 = new \ThriftTest\Insanity();
                             $xfer += $input->readI32($key361);
                             $val362 = new \ThriftTest\Insanity();
                             $xfer += $val362->read($input);
                             $val355[$key361] = $val362;
                         }
                         $xfer += $input->readMapEnd();
                         $this->success[$key354] = $val355;
                     }
                     $xfer += $input->readMapEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             default:
                 $xfer += $input->skip($ftype);
                 break;
         }
         $xfer += $input->readFieldEnd();
     }
     $xfer += $input->readStructEnd();
     return $xfer;
 }