proto library Client - Class AnyBase (v5.36.2)

Reference documentation and code samples for the proto library Client class AnyBase.

Base class for Google\Protobuf\Any, this contains hand-written convenience methods like pack() and unpack().

Namespace

Google \ Protobuf \ Internal

Methods

unpack

This method will try to resolve the type_url in Any message to get the targeted message type. If failed, an error will be thrown. Otherwise, the method will create a message of the targeted type and fill it with the decoded value in Any.

Returns
Type Description
Message unpacked message

pack

The type_url will be created according to the given message’s type and the value is encoded data from the given message.

.

Parameter
Name Description
msg Message

A proto message.

is

This method returns whether the type_url in any_message is corresponded to the given class.

Parameter
Name Description
klass string

The fully qualified PHP class name of a proto message type.

Constants

TYPE_URL_PREFIX

Value: 'type.googleapis.com/'