public function write($output) { $xfer = 0; $xfer += $output->writeStructBegin('GetMediaRequest'); if ($this->token !== null) { if (!is_object($this->token)) { throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); } $xfer += $output->writeFieldBegin('token', TType::STRUCT, 1); $xfer += $this->token->write($output); $xfer += $output->writeFieldEnd(); } if ($this->mediaId !== null) { $xfer += $output->writeFieldBegin('mediaId', TType::STRING, 2); $xfer += $output->writeString($this->mediaId); $xfer += $output->writeFieldEnd(); } if ($this->desiredThumbnailSize !== null) { if (!is_object($this->desiredThumbnailSize)) { throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); } $xfer += $output->writeFieldBegin('desiredThumbnailSize', TType::STRUCT, 3); $xfer += $this->desiredThumbnailSize->write($output); $xfer += $output->writeFieldEnd(); } $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; }
public function write($output) { $xfer = 0; $xfer += $output->writeStructBegin('Image'); if ($this->imageType !== null) { $xfer += $output->writeFieldBegin('imageType', TType::I32, 1); $xfer += $output->writeI32($this->imageType); $xfer += $output->writeFieldEnd(); } if ($this->data !== null) { $xfer += $output->writeFieldBegin('data', TType::STRING, 2); $xfer += $output->writeString($this->data); $xfer += $output->writeFieldEnd(); } if ($this->dimension !== null) { if (!is_object($this->dimension)) { throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); } $xfer += $output->writeFieldBegin('dimension', TType::STRUCT, 3); $xfer += $this->dimension->write($output); $xfer += $output->writeFieldEnd(); } $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; }