Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function serializedSize(\Protobuf\ComputeSizeContext $context)
 {
     $calculator = $context->getSizeCalculator();
     $size = 0;
     if ($this->pokemon_data !== null) {
         $innerSize = $this->pokemon_data->serializedSize($context);
         $size += 1;
         $size += $innerSize;
         $size += $calculator->computeVarintSize($innerSize);
     }
     if ($this->trainer_public_profile !== null) {
         $innerSize = $this->trainer_public_profile->serializedSize($context);
         $size += 1;
         $size += $innerSize;
         $size += $calculator->computeVarintSize($innerSize);
     }
     if ($this->training_pokemon !== null) {
         $innerSize = $this->training_pokemon->serializedSize($context);
         $size += 1;
         $size += $innerSize;
         $size += $calculator->computeVarintSize($innerSize);
     }
     if ($this->extensions !== null) {
         $size += $this->extensions->serializedSize($context);
     }
     return $size;
 }
 /**
  * {@inheritdoc}
  */
 public function serializedSize(\Protobuf\ComputeSizeContext $context)
 {
     $calculator = $context->getSizeCalculator();
     $size = 0;
     if ($this->active_pokemon !== null) {
         $innerSize = $this->active_pokemon->serializedSize($context);
         $size += 1;
         $size += $innerSize;
         $size += $calculator->computeVarintSize($innerSize);
     }
     if ($this->trainer_public_profile !== null) {
         $innerSize = $this->trainer_public_profile->serializedSize($context);
         $size += 1;
         $size += $innerSize;
         $size += $calculator->computeVarintSize($innerSize);
     }
     if ($this->reverse_pokemon !== null) {
         foreach ($this->reverse_pokemon as $val) {
             $innerSize = $val->serializedSize($context);
             $size += 1;
             $size += $innerSize;
             $size += $calculator->computeVarintSize($innerSize);
         }
     }
     if ($this->defeated_pokemon !== null) {
         foreach ($this->defeated_pokemon 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;
 }