public function write($output) { $xfer = 0; $xfer += $output->writeStructBegin('TCLIService_GetCatalogs_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(); } $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; }