Reference documentation and code samples for the proto library Client class Message.
Parent class of all proto messages. Users should not instantiate this class or extend this class or its child classes by their own. See the comment of specific functions for more details.
Namespace
Google \ Protobuf \ InternalMethods
clear
Clear all containing fields.
| Returns | |
|---|---|
| Type | Description |
null |
|
discardUnknownFields
Clear all unknown fields previously parsed.
| Returns | |
|---|---|
| Type | Description |
null |
|
mergeFrom
Merges the contents of the specified message into current message.
This method merges the contents of the specified message into the current message. Singular fields that are set in the specified message overwrite the corresponding fields in the current message. Repeated fields are appended. Map fields key-value pairs are overwritten. Singular/Oneof sub-messages are recursively merged. All overwritten sub-messages are deep-copied.
| Parameter | |
|---|---|
| Name | Description |
msg |
object
Protobuf message to be merged from. |
| Returns | |
|---|---|
| Type | Description |
null |
|
mergeFromString
Parses a protocol buffer contained in a string.
This function takes a string in the (non-human-readable) binary wire format, matching the encoding output by serializeToString(). See mergeFrom() for merging behavior, if the field is already set in the specified message.
| Parameters | |
|---|---|
| Name | Description |
data |
string
Binary protobuf data. |
recursion_limit |
int
Maximum message nesting depth allowed while parsing. Defaults to 100. |
| Returns | |
|---|---|
| Type | Description |
null |
|
mergeFromJsonString
Parses a json string to protobuf message.
This function takes a string in the json wire format, matching the encoding output by serializeToJsonString(). See mergeFrom() for merging behavior, if the field is already set in the specified message.
| Parameters | |
|---|---|
| Name | Description |
data |
string
Json protobuf data. |
ignore_unknown |
bool
|
| Returns | |
|---|---|
| Type | Description |
null |
|
serializeToString
Serialize the message to string.
| Parameter | |
|---|---|
| Name | Description |
recursion_limit |
int
Accepted for API parity with the C extension (and with mergeFromString). The pure-PHP encoder (CodedOutputStream) does not enforce a recursion-depth guard, so this argument has no effect here and deep messages always serialize successfully. The C extension does enforce it and throws "Max nesting exceeded" past the limit. Defaults to 100. |
| Returns | |
|---|---|
| Type | Description |
string |
Serialized binary protobuf data. |
serializeToJsonString
Serialize the message to json string.
| Parameter | |
|---|---|
| Name | Description |
options |
mixed
|
| Returns | |
|---|---|
| Type | Description |
string |
Serialized json protobuf data. |