예제 #1
0
 public function write($output)
 {
     $xfer = 0;
     $xfer += $output->writeStructBegin('Xception2');
     if ($this->errorCode !== null) {
         $xfer += $output->writeFieldBegin('errorCode', TType::I32, 1);
         $xfer += $output->writeI32($this->errorCode);
         $xfer += $output->writeFieldEnd();
     }
     if ($this->struct_thing !== null) {
         if (!is_object($this->struct_thing)) {
             throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
         }
         $xfer += $output->writeFieldBegin('struct_thing', TType::STRUCT, 2);
         $xfer += $this->struct_thing->write($output);
         $xfer += $output->writeFieldEnd();
     }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;
 }
예제 #2
0
 public function write($output)
 {
     $xfer = 0;
     $xfer += $output->writeStructBegin('ThriftTest_testMultiException_result');
     if ($this->success !== null) {
         if (!is_object($this->success)) {
             throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
         }
         $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);
         $xfer += $this->success->write($output);
         $xfer += $output->writeFieldEnd();
     }
     if ($this->err1 !== null) {
         $xfer += $output->writeFieldBegin('err1', TType::STRUCT, 1);
         $xfer += $this->err1->write($output);
         $xfer += $output->writeFieldEnd();
     }
     if ($this->err2 !== null) {
         $xfer += $output->writeFieldBegin('err2', TType::STRUCT, 2);
         $xfer += $this->err2->write($output);
         $xfer += $output->writeFieldEnd();
     }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;
 }