• Модуль: pull
  • Путь к файлу: ~/bitrix/modules/pull/lib/protobuf/outgoingmessage.php
  • Класс: BitrixPullProtobufOutgoingMessage
  • Вызов: OutgoingMessage::writeTo
public function writeTo(ProtobufWriteContext $context)
    {
        $stream      = $context->getStream();
        $writer      = $context->getWriter();
        $sizeContext = $context->getComputeSizeContext();

        if ($this->id !== null) {
            $writer->writeVarint($stream, 10);
            $writer->writeByteStream($stream, $this->id);
        }

        if ($this->body !== null) {
            $writer->writeVarint($stream, 18);
            $writer->writeString($stream, $this->body);
        }

        if ($this->expiry !== null) {
            $writer->writeVarint($stream, 24);
            $writer->writeVarint($stream, $this->expiry);
        }

        if ($this->created !== null) {
            $writer->writeVarint($stream, 37);
            $writer->writeFixed32($stream, $this->created);
        }

        if ($this->sender !== null) {
            $writer->writeVarint($stream, 42);
            $writer->writeVarint($stream, $this->sender->serializedSize($sizeContext));
            $this->sender->writeTo($context);
        }

        if ($this->extensions !== null) {
            $this->extensions->writeTo($context);
        }

        return $stream;
    }