Option.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?php
  2. # Generated by the protocol buffer compiler. DO NOT EDIT!
  3. # source: google/protobuf/type.proto
  4. namespace Google\Protobuf;
  5. use Google\Protobuf\Internal\GPBType;
  6. use Google\Protobuf\Internal\RepeatedField;
  7. use Google\Protobuf\Internal\GPBUtil;
  8. /**
  9. * A protocol buffer option, which can be attached to a message, field,
  10. * enumeration, etc.
  11. *
  12. * Generated from protobuf message <code>google.protobuf.Option</code>
  13. */
  14. class Option extends \Google\Protobuf\Internal\Message
  15. {
  16. /**
  17. * The option's name. For protobuf built-in options (options defined in
  18. * descriptor.proto), this is the short name. For example, `"map_entry"`.
  19. * For custom options, it should be the fully-qualified name. For example,
  20. * `"google.api.http"`.
  21. *
  22. * Generated from protobuf field <code>string name = 1;</code>
  23. */
  24. protected $name = '';
  25. /**
  26. * The option's value packed in an Any message. If the value is a primitive,
  27. * the corresponding wrapper type defined in google/protobuf/wrappers.proto
  28. * should be used. If the value is an enum, it should be stored as an int32
  29. * value using the google.protobuf.Int32Value type.
  30. *
  31. * Generated from protobuf field <code>.google.protobuf.Any value = 2;</code>
  32. */
  33. protected $value = null;
  34. /**
  35. * Constructor.
  36. *
  37. * @param array $data {
  38. * Optional. Data for populating the Message object.
  39. *
  40. * @type string $name
  41. * The option's name. For protobuf built-in options (options defined in
  42. * descriptor.proto), this is the short name. For example, `"map_entry"`.
  43. * For custom options, it should be the fully-qualified name. For example,
  44. * `"google.api.http"`.
  45. * @type \Google\Protobuf\Any $value
  46. * The option's value packed in an Any message. If the value is a primitive,
  47. * the corresponding wrapper type defined in google/protobuf/wrappers.proto
  48. * should be used. If the value is an enum, it should be stored as an int32
  49. * value using the google.protobuf.Int32Value type.
  50. * }
  51. */
  52. public function __construct($data = NULL) {
  53. \GPBMetadata\Google\Protobuf\Type::initOnce();
  54. parent::__construct($data);
  55. }
  56. /**
  57. * The option's name. For protobuf built-in options (options defined in
  58. * descriptor.proto), this is the short name. For example, `"map_entry"`.
  59. * For custom options, it should be the fully-qualified name. For example,
  60. * `"google.api.http"`.
  61. *
  62. * Generated from protobuf field <code>string name = 1;</code>
  63. * @return string
  64. */
  65. public function getName()
  66. {
  67. return $this->name;
  68. }
  69. /**
  70. * The option's name. For protobuf built-in options (options defined in
  71. * descriptor.proto), this is the short name. For example, `"map_entry"`.
  72. * For custom options, it should be the fully-qualified name. For example,
  73. * `"google.api.http"`.
  74. *
  75. * Generated from protobuf field <code>string name = 1;</code>
  76. * @param string $var
  77. * @return $this
  78. */
  79. public function setName($var)
  80. {
  81. GPBUtil::checkString($var, True);
  82. $this->name = $var;
  83. return $this;
  84. }
  85. /**
  86. * The option's value packed in an Any message. If the value is a primitive,
  87. * the corresponding wrapper type defined in google/protobuf/wrappers.proto
  88. * should be used. If the value is an enum, it should be stored as an int32
  89. * value using the google.protobuf.Int32Value type.
  90. *
  91. * Generated from protobuf field <code>.google.protobuf.Any value = 2;</code>
  92. * @return \Google\Protobuf\Any|null
  93. */
  94. public function getValue()
  95. {
  96. return isset($this->value) ? $this->value : null;
  97. }
  98. public function hasValue()
  99. {
  100. return isset($this->value);
  101. }
  102. public function clearValue()
  103. {
  104. unset($this->value);
  105. }
  106. /**
  107. * The option's value packed in an Any message. If the value is a primitive,
  108. * the corresponding wrapper type defined in google/protobuf/wrappers.proto
  109. * should be used. If the value is an enum, it should be stored as an int32
  110. * value using the google.protobuf.Int32Value type.
  111. *
  112. * Generated from protobuf field <code>.google.protobuf.Any value = 2;</code>
  113. * @param \Google\Protobuf\Any $var
  114. * @return $this
  115. */
  116. public function setValue($var)
  117. {
  118. GPBUtil::checkMessage($var, \Google\Protobuf\Any::class);
  119. $this->value = $var;
  120. return $this;
  121. }
  122. }