Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function serializedSize(\Protobuf\ComputeSizeContext $context)
 {
     $calculator = $context->getSizeCalculator();
     $size = 0;
     if ($this->status_code !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->status_code->value());
     }
     if ($this->request_id !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->request_id);
     }
     if ($this->api_url !== null) {
         $size += 1;
         $size += $calculator->computeStringSize($this->api_url);
     }
     if ($this->platform_returns !== null) {
         foreach ($this->platform_returns as $val) {
             $innerSize = $val->serializedSize($context);
             $size += 1;
             $size += $innerSize;
             $size += $calculator->computeVarintSize($innerSize);
         }
     }
     if ($this->auth_ticket !== null) {
         $innerSize = $this->auth_ticket->serializedSize($context);
         $size += 1;
         $size += $innerSize;
         $size += $calculator->computeVarintSize($innerSize);
     }
     if ($this->returns !== null) {
         foreach ($this->returns as $val) {
             $size += 2;
             $size += $calculator->computeByteStreamSize($val);
         }
     }
     if ($this->error !== null) {
         $size += 2;
         $size += $calculator->computeStringSize($this->error);
     }
     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->status_code !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->status_code);
     }
     if ($this->request_id !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->request_id);
     }
     if ($this->requests !== null) {
         foreach ($this->requests as $val) {
             $innerSize = $val->serializedSize($context);
             $size += 1;
             $size += $innerSize;
             $size += $calculator->computeVarintSize($innerSize);
         }
     }
     if ($this->platform_requests !== null) {
         foreach ($this->platform_requests as $val) {
             $innerSize = $val->serializedSize($context);
             $size += 1;
             $size += $innerSize;
             $size += $calculator->computeVarintSize($innerSize);
         }
     }
     if ($this->latitude !== null) {
         $size += 1;
         $size += 8;
     }
     if ($this->longitude !== null) {
         $size += 1;
         $size += 8;
     }
     if ($this->accuracy !== null) {
         $size += 1;
         $size += 8;
     }
     if ($this->auth_info !== null) {
         $innerSize = $this->auth_info->serializedSize($context);
         $size += 1;
         $size += $innerSize;
         $size += $calculator->computeVarintSize($innerSize);
     }
     if ($this->auth_ticket !== null) {
         $innerSize = $this->auth_ticket->serializedSize($context);
         $size += 1;
         $size += $innerSize;
         $size += $calculator->computeVarintSize($innerSize);
     }
     if ($this->ms_since_last_locationfix !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->ms_since_last_locationfix);
     }
     if ($this->extensions !== null) {
         $size += $this->extensions->serializedSize($context);
     }
     return $size;
 }