abstract class AbstractResource implements ResourceInterface, Serializable

Represents a top-level abstraction of a remote API resource. Usually a resource represents a discrete entity such as a Server, Container, Load Balancer. Apart from a representation of state, a resource can also execute RESTFul operations on itself (updating, deleting, listing) or on other models.

Methods

populateFromResponse (ResponseInterface $response) : AbstractResource

All models which represent an API resource should be able to be populated from a {see ResponseInterface} object.

populateFromArray (array $array) : mixed|void

No description

model (string $class, $data = null) : ResourceInterface

No description

serialize () : string

No description

Details

populateFromResponse(ResponseInterface $response)

All models which represent an API resource should be able to be populated from a {see ResponseInterface} object.

Parameters

$response ResponseInterface

Return value

AbstractResource

Example code

$abstractResource = $abstractResource->populateFromResponse($response);

populateFromArray(array $array)

Parameters

$array array

Return value

mixed|void

Example code

$response = $abstractResource->populateFromArray($array);

model(string $class, $data = null)

Parameters

$class string
$data

Return value

ResourceInterface

Example code

$resourceInterface = $abstractResource->model($class, $data);

serialize()

Return value

string

Example code

$string = $abstractResource->serialize();