/** * {@inheritdoc} */ public function writeTo(\Protobuf\WriteContext $context) { $stream = $context->getStream(); $writer = $context->getWriter(); $sizeContext = $context->getComputeSizeContext(); if ($this->gym_id !== null) { $writer->writeVarint($stream, 10); $writer->writeString($stream, $this->gym_id); } if ($this->battle_id !== null) { $writer->writeVarint($stream, 18); $writer->writeString($stream, $this->battle_id); } if ($this->attack_actions !== null) { foreach ($this->attack_actions as $val) { $writer->writeVarint($stream, 26); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->writeTo($context); } } if ($this->last_retrieved_action !== null) { $writer->writeVarint($stream, 34); $writer->writeVarint($stream, $this->last_retrieved_action->serializedSize($sizeContext)); $this->last_retrieved_action->writeTo($context); } if ($this->player_latitude !== null) { $writer->writeVarint($stream, 41); $writer->writeDouble($stream, $this->player_latitude); } if ($this->player_longitude !== null) { $writer->writeVarint($stream, 49); $writer->writeDouble($stream, $this->player_longitude); } if ($this->extensions !== null) { $this->extensions->writeTo($context); } return $stream; }