156 return \google\protobuf\DescriptorProto::fromArray([
159 \google\protobuf\FieldDescriptorProto::fromArray([
163 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(),
164 'type_name' =>
'.SenderType'
166 \google\protobuf\FieldDescriptorProto::fromArray([
170 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()
194 public function writeTo(\Protobuf\WriteContext $context)
196 $stream = $context->getStream();
197 $writer = $context->getWriter();
198 $sizeContext = $context->getComputeSizeContext();
200 if ($this->type !==
null) {
201 $writer->writeVarint($stream, 8);
202 $writer->writeVarint($stream, $this->type->value());
205 if ($this->
id !==
null) {
206 $writer->writeVarint($stream, 18);
207 $writer->writeByteStream($stream, $this->
id);
220 public function readFrom(\Protobuf\ReadContext $context)
222 $reader = $context->getReader();
223 $length = $context->getLength();
224 $stream = $context->getStream();
226 $limit = ($length !==
null)
227 ? ($stream->tell() + $length)
230 while ($limit ===
null || $stream->tell() < $limit) {
232 if ($stream->eof()) {
236 $key = $reader->readVarint($stream);
237 $wire = \Protobuf\WireFormat::getTagWireType($key);
238 $tag = \Protobuf\WireFormat::getTagFieldNumber($key);
240 if ($stream->eof()) {
245 \Protobuf\WireFormat::assertWireType($wire, 14);
247 $this->type = \Bitrix\Pull\Protobuf\SenderType::valueOf($reader->readVarint($stream));
253 \Protobuf\WireFormat::assertWireType($wire, 12);
255 $this->
id = $reader->readByteStream($stream);
263 if ($extension !==
null) {
264 $this->
extensions()->add($extension, $extension->readFrom($context, $wire));
273 $data = $reader->readUnknown($stream, $wire);
274 $unknown = new \Protobuf\Unknown($tag, $wire, $data);
286 $calculator = $context->getSizeCalculator();
289 if ($this->type !==
null) {
291 $size += $calculator->computeVarintSize($this->type->value());
294 if ($this->
id !==
null) {
296 $size += $calculator->computeByteStreamSize($this->
id);
300 $size += $this->
extensions->serializedSize($context);