Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function readFrom(\Protobuf\ReadContext $context)
 {
     $reader = $context->getReader();
     $length = $context->getLength();
     $stream = $context->getStream();
     $limit = $length !== null ? $stream->tell() + $length : null;
     while ($limit === null || $stream->tell() < $limit) {
         if ($stream->eof()) {
             break;
         }
         $key = $reader->readVarint($stream);
         $wire = \Protobuf\WireFormat::getTagWireType($key);
         $tag = \Protobuf\WireFormat::getTagFieldNumber($key);
         if ($stream->eof()) {
             break;
         }
         if ($tag === 1) {
             \Protobuf\WireFormat::assertWireType($wire, 11);
             $innerSize = $reader->readVarint($stream);
             $innerMessage = new \POGOProtos\Data\Gym\GymState();
             $this->gym_state = $innerMessage;
             $context->setLength($innerSize);
             $innerMessage->readFrom($context);
             $context->setLength($length);
             continue;
         }
         if ($tag === 2) {
             \Protobuf\WireFormat::assertWireType($wire, 11);
             $innerSize = $reader->readVarint($stream);
             $innerMessage = new \POGOProtos\Data\Battle\BattleParticipant();
             if ($this->attackers === null) {
                 $this->attackers = new \Protobuf\MessageCollection();
             }
             $this->attackers->add($innerMessage);
             $context->setLength($innerSize);
             $innerMessage->readFrom($context);
             $context->setLength($length);
             continue;
         }
         if ($tag === 3) {
             $innerSize = $reader->readVarint($stream);
             $innerLimit = $stream->tell() + $innerSize;
             if ($this->player_experience_awarded === null) {
                 $this->player_experience_awarded = new \Protobuf\ScalarCollection();
             }
             while ($stream->tell() < $innerLimit) {
                 $this->player_experience_awarded->add($reader->readVarint($stream));
             }
             continue;
         }
         if ($tag === 4) {
             \Protobuf\WireFormat::assertWireType($wire, 3);
             $this->next_defender_pokemon_id = $reader->readVarint($stream);
             continue;
         }
         if ($tag === 5) {
             \Protobuf\WireFormat::assertWireType($wire, 5);
             $this->gym_points_delta = $reader->readVarint($stream);
             continue;
         }
         $extensions = $context->getExtensionRegistry();
         $extension = $extensions ? $extensions->findByNumber(__CLASS__, $tag) : null;
         if ($extension !== null) {
             $this->extensions()->add($extension, $extension->readFrom($context, $wire));
             continue;
         }
         if ($this->unknownFieldSet === null) {
             $this->unknownFieldSet = new \Protobuf\UnknownFieldSet();
         }
         $data = $reader->readUnknown($stream, $wire);
         $unknown = new \Protobuf\Unknown($tag, $wire, $data);
         $this->unknownFieldSet->add($unknown);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function readFrom(\Protobuf\ReadContext $context)
 {
     $reader = $context->getReader();
     $length = $context->getLength();
     $stream = $context->getStream();
     $limit = $length !== null ? $stream->tell() + $length : null;
     while ($limit === null || $stream->tell() < $limit) {
         if ($stream->eof()) {
             break;
         }
         $key = $reader->readVarint($stream);
         $wire = \Protobuf\WireFormat::getTagWireType($key);
         $tag = \Protobuf\WireFormat::getTagFieldNumber($key);
         if ($stream->eof()) {
             break;
         }
         if ($tag === 1) {
             \Protobuf\WireFormat::assertWireType($wire, 11);
             $innerSize = $reader->readVarint($stream);
             $innerMessage = new \POGOProtos\Data\Gym\GymState();
             $this->gym_state = $innerMessage;
             $context->setLength($innerSize);
             $innerMessage->readFrom($context);
             $context->setLength($length);
             continue;
         }
         if ($tag === 2) {
             \Protobuf\WireFormat::assertWireType($wire, 9);
             $this->name = $reader->readString($stream);
             continue;
         }
         if ($tag === 3) {
             \Protobuf\WireFormat::assertWireType($wire, 9);
             if ($this->urls === null) {
                 $this->urls = new \Protobuf\ScalarCollection();
             }
             $this->urls->add($reader->readString($stream));
             continue;
         }
         if ($tag === 4) {
             \Protobuf\WireFormat::assertWireType($wire, 14);
             $this->result = \POGOProtos\Networking\Responses\GetGymDetailsResponse\Result::valueOf($reader->readVarint($stream));
             continue;
         }
         if ($tag === 5) {
             \Protobuf\WireFormat::assertWireType($wire, 9);
             $this->description = $reader->readString($stream);
             continue;
         }
         $extensions = $context->getExtensionRegistry();
         $extension = $extensions ? $extensions->findByNumber(__CLASS__, $tag) : null;
         if ($extension !== null) {
             $this->extensions()->add($extension, $extension->readFrom($context, $wire));
             continue;
         }
         if ($this->unknownFieldSet === null) {
             $this->unknownFieldSet = new \Protobuf\UnknownFieldSet();
         }
         $data = $reader->readUnknown($stream, $wire);
         $unknown = new \Protobuf\Unknown($tag, $wire, $data);
         $this->unknownFieldSet->add($unknown);
     }
 }