Google API Core Client - Class Serializer (1.35.0)
Stay organized with collections
Save and categorize content based on your preferences.
Reference documentation and code samples for the Google API Core Client class Serializer.
Collection of methods to help with serialization of protobuf objects
Namespace
Google \ ApiCore
Methods
__construct
Parameters |
Name |
Description |
fieldTransformers |
array
An array mapping field names to transformation functions
|
messageTypeTransformers |
array
An array mapping message names to transformation functions
|
decodeFieldTransformers |
array
An array mapping field names to transformation functions
|
decodeMessageTypeTransformers |
array
An array mapping message names to transformation functions
|
customEncoders |
mixed
|
encodeMessage
Encode protobuf message as a PHP array
Parameter |
Name |
Description |
message |
mixed
|
Returns |
Type |
Description |
array |
|
decodeMessage
Decode PHP array into the specified protobuf message
Parameters |
Name |
Description |
message |
mixed
|
data |
array
|
Returns |
Type |
Description |
mixed |
|
static::serializeToJson
Returns |
Type |
Description |
string |
Json representation of $message |
static::serializeToPhpArray
Returns |
Type |
Description |
array |
PHP array representation of $message |
Decode metadata received from gRPC status object
Parameter |
Name |
Description |
metadata |
array
|
Returns |
Type |
Description |
array |
|
static::decodeAnyMessages
Decode an array of Any messages into a printable PHP array.
Parameter |
Name |
Description |
anyArray |
iterable
|
Returns |
Type |
Description |
array |
|
static::getGetter
Parameter |
Name |
Description |
name |
string
|
Returns |
Type |
Description |
string |
Getter function |
static::getSetter
Parameter |
Name |
Description |
name |
string
|
Returns |
Type |
Description |
string |
Setter function |
static::toSnakeCase
Convert string from camelCase to snake_case
Parameter |
Name |
Description |
key |
string
|
Returns |
Type |
Description |
string |
|
static::toCamelCase
Convert string from snake_case to camelCase
Parameter |
Name |
Description |
key |
string
|
Returns |
Type |
Description |
string |
|
Constants
MAP_KEY_FIELD_NAME
MAP_VALUE_FIELD_NAME
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-11-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-11-07 UTC."],[],[]]