Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function serializedSize(\Protobuf\ComputeSizeContext $context)
 {
     $calculator = $context->getSizeCalculator();
     $size = 0;
     if ($this->badge_type !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->badge_type->value());
     }
     if ($this->rank !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->rank);
     }
     if ($this->start_value !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->start_value);
     }
     if ($this->end_value !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->end_value);
     }
     if ($this->current_value !== null) {
         $size += 1;
         $size += 8;
     }
     if ($this->extensions !== null) {
         $size += $this->extensions->serializedSize($context);
     }
     return $size;
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function serializedSize(\Protobuf\ComputeSizeContext $context)
 {
     $calculator = $context->getSizeCalculator();
     $size = 0;
     if ($this->badge_type !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->badge_type->value());
     }
     if ($this->badge_rank !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->badge_rank);
     }
     if ($this->targets !== null) {
         foreach ($this->targets as $val) {
             $size += 1;
             $size += $calculator->computeVarintSize($val);
         }
     }
     if ($this->capture_reward !== null) {
         foreach ($this->capture_reward as $val) {
             $innerSize = $val->serializedSize($context);
             $size += 1;
             $size += $innerSize;
             $size += $calculator->computeVarintSize($innerSize);
         }
     }
     if ($this->extensions !== null) {
         $size += $this->extensions->serializedSize($context);
     }
     return $size;
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function serializedSize(\Protobuf\ComputeSizeContext $context)
 {
     $calculator = $context->getSizeCalculator();
     $size = 0;
     if ($this->badge_type !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->badge_type->value());
     }
     if ($this->level !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->level);
     }
     if ($this->next_equip_change_allowed_timestamp_ms !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->next_equip_change_allowed_timestamp_ms);
     }
     if ($this->extensions !== null) {
         $size += $this->extensions->serializedSize($context);
     }
     return $size;
 }
 /**
  * {@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, 8);
             $this->success = $reader->readBool($stream);
             continue;
         }
         if ($tag === 2) {
             $innerSize = $reader->readVarint($stream);
             $innerLimit = $stream->tell() + $innerSize;
             if ($this->awarded_badges === null) {
                 $this->awarded_badges = new \Protobuf\EnumCollection();
             }
             while ($stream->tell() < $innerLimit) {
                 $this->awarded_badges->add(\POGOProtos\Enums\BadgeType::valueOf($reader->readVarint($stream)));
             }
             continue;
         }
         if ($tag === 3) {
             $innerSize = $reader->readVarint($stream);
             $innerLimit = $stream->tell() + $innerSize;
             if ($this->awarded_badge_levels === null) {
                 $this->awarded_badge_levels = new \Protobuf\ScalarCollection();
             }
             while ($stream->tell() < $innerLimit) {
                 $this->awarded_badge_levels->add($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);
     }
 }