/**
  * {@inheritdoc}
  */
 public function serializedSize(\Protobuf\ComputeSizeContext $context)
 {
     $calculator = $context->getSizeCalculator();
     $size = 0;
     if ($this->name !== null) {
         $size += 1;
         $size += $calculator->computeStringSize($this->name);
     }
     if ($this->field !== null) {
         foreach ($this->field as $val) {
             $innerSize = $val->serializedSize($context);
             $size += 1;
             $size += $innerSize;
             $size += $calculator->computeVarintSize($innerSize);
         }
     }
     if ($this->extension !== null) {
         foreach ($this->extension as $val) {
             $innerSize = $val->serializedSize($context);
             $size += 1;
             $size += $innerSize;
             $size += $calculator->computeVarintSize($innerSize);
         }
     }
     if ($this->nested_type !== null) {
         foreach ($this->nested_type as $val) {
             $innerSize = $val->serializedSize($context);
             $size += 1;
             $size += $innerSize;
             $size += $calculator->computeVarintSize($innerSize);
         }
     }
     if ($this->enum_type !== null) {
         foreach ($this->enum_type as $val) {
             $innerSize = $val->serializedSize($context);
             $size += 1;
             $size += $innerSize;
             $size += $calculator->computeVarintSize($innerSize);
         }
     }
     if ($this->extension_range !== null) {
         foreach ($this->extension_range as $val) {
             $innerSize = $val->serializedSize($context);
             $size += 1;
             $size += $innerSize;
             $size += $calculator->computeVarintSize($innerSize);
         }
     }
     if ($this->oneof_decl !== null) {
         foreach ($this->oneof_decl as $val) {
             $innerSize = $val->serializedSize($context);
             $size += 1;
             $size += $innerSize;
             $size += $calculator->computeVarintSize($innerSize);
         }
     }
     if ($this->options !== null) {
         $innerSize = $this->options->serializedSize($context);
         $size += 1;
         $size += $innerSize;
         $size += $calculator->computeVarintSize($innerSize);
     }
     if ($this->reserved_range !== null) {
         foreach ($this->reserved_range as $val) {
             $innerSize = $val->serializedSize($context);
             $size += 1;
             $size += $innerSize;
             $size += $calculator->computeVarintSize($innerSize);
         }
     }
     if ($this->reserved_name !== null) {
         foreach ($this->reserved_name as $val) {
             $size += 1;
             $size += $calculator->computeStringSize($val);
         }
     }
     if ($this->extensions !== null) {
         $size += $this->extensions->serializedSize($context);
     }
     return $size;
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public static function descriptor()
 {
     $options = \google\protobuf\MessageOptions::fromArray([]);
     return \google\protobuf\DescriptorProto::fromArray(['name' => 'TagsEntry', 'field' => [\google\protobuf\FieldDescriptorProto::fromArray(['number' => 1, 'name' => 'key', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()]), \google\protobuf\FieldDescriptorProto::fromArray(['number' => 2, 'name' => 'value', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()])], 'options' => $options]);
 }