Skip to main content

Gravity_Forms\Gravity_Forms\External_API\GF_API_Response

Class GF_API_Response

An abstracted Response class used to standardize the responses we send back from an API Connector. Includes standardized serialization and JSON methods to support saving the class to the Database.

Since: 2.5

Source: includes/external-api/class-gf-api-response.php:15

Details

  • Kind: class

  • Namespace: Gravity_Forms\Gravity_Forms\External_API

  • Implements: JsonSerializable, Serializable

Properties

PropertyTypeDescription
$dataarrayThe data for this response.
$statusarrayThe status for this response.
$errorsarrayThe errors (if any) for this response.
$metaarrayThe meta data (if any) for this response.

Methods

MethodDescription
get_data()Get the data for this response
get_errors()Get any errors on this response.
get_status()Get the response status.
get_meta()Get the response meta.
has_errors()Determine if the response has any errors.
get_data_value()Get a specific piece of the data.
serialize()Standardization of the class when serialized and unserialized. Useful for standardizing how it
__serialize()Prepares the object for serializing.
unserialize()Hydrate the Response data when unserializing.
__unserialize()Hydrates the object when unserializing.

Method Reference

get_data()

public function get_data()

Get the data for this response

Returns

  • array

Source: includes/external-api/class-gf-api-response.php:87

get_errors()

public function get_errors()

Get any errors on this response.

Returns

  • array

Source: includes/external-api/class-gf-api-response.php:96

get_status()

public function get_status()

Get the response status.

Returns

  • array

Source: includes/external-api/class-gf-api-response.php:105

get_meta()

public function get_meta()

Get the response meta.

Returns

  • array

Source: includes/external-api/class-gf-api-response.php:114

has_errors()

public function has_errors()

Determine if the response has any errors.

Returns

  • bool

Source: includes/external-api/class-gf-api-response.php:123

get_data_value()

public function get_data_value( $name, $index=0 )

Get a specific piece of the data.

Parameters

NameTypeDefaultDescription
$name
$indexint0

Returns

  • mixed | null

Source: includes/external-api/class-gf-api-response.php:135

serialize()

public function serialize()

Standardization of the class when serialized and unserialized. Useful for standardizing how it

is stored in the Database.

Returns

  • string

Source: includes/external-api/class-gf-api-response.php:149

__serialize()

public function __serialize()

Prepares the object for serializing.

Returns

  • array

Since: 2.6.2

Source: includes/external-api/class-gf-api-response.php:160

unserialize()

public function unserialize( $serialized )

Hydrate the Response data when unserializing.

Parameters

NameTypeDefaultDescription
$serializedstring

Source: includes/external-api/class-gf-api-response.php:174

__unserialize()

public function __unserialize( $data )

Hydrates the object when unserializing.

Parameters

NameTypeDefaultDescription
$dataarrayThe unserialized data.

Returns

  • void

Since: 2.6.2

Source: includes/external-api/class-gf-api-response.php:187