class ApiResource implements Stringable, ArrayAccess, JsonSerializable, Arrayable, Jsonable mixin ApiResponse

Traits

Methods

mixed
forwardCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object.

mixed
forwardDecoratedCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object, returning $this if the forwarded call returned itself.

static never
throwBadMethodCallException(string $method)

Throw a bad method call exception for the given method.

__construct(ApiResponse $response, ApiRequest $request)

Create a new resource instance.

string
__toString()

No description

bool
__isset(string $key)

Determine if an attribute exists on the resource.

void
__unset(string $key)

Unset an attribute on the resource.

mixed
__get(string $key)

Dynamically get properties from the underlying resource.

mixed
__call(string $method, array $parameters)

Dynamically pass method calls to the underlying resource.

getResponse()

No description

getRequest()

No description

static ApiResource
make(mixed ...$parameters)

Create a new resource instance.

array
resolve()

Resolve the resource to an array.

array
toArray()

Transform the resource into an array.

string
toJson(int $options = 0)

Convert the resource to its JSON representation.

mixed
jsonSerialize()

Prepare the resource for JSON serialization.

bool
offsetExists(mixed $offset)

Implementation of ArrayAccess::offsetExists.

mixed
offsetGet(mixed $offset)

Implementation of ArrayAccess::offsetGet.

void
offsetSet(mixed $offset, mixed $value)

Implementation of ArrayAccess::offsetSet.

void
offsetUnset(mixed $offset)

Implementation of ArrayAccess::offsetUnset.

Details

in ForwardsCalls at line 22
protected mixed forwardCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object.

Parameters

mixed $object
string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in ForwardsCalls at line 52
protected mixed forwardDecoratedCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object, returning $this if the forwarded call returned itself.

Parameters

mixed $object
string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in ForwardsCalls at line 66
static protected never throwBadMethodCallException(string $method)

Throw a bad method call exception for the given method.

Parameters

string $method

Return Value

never

Exceptions

BadMethodCallException

at line 25
__construct(ApiResponse $response, ApiRequest $request)

Create a new resource instance.

Parameters

ApiResponse $response
ApiRequest $request

at line 31
string __toString()

No description

Return Value

string

at line 39
bool __isset(string $key)

Determine if an attribute exists on the resource.

Parameters

string $key

Return Value

bool

at line 47
void __unset(string $key)

Unset an attribute on the resource.

Parameters

string $key

Return Value

void

at line 55
mixed __get(string $key)

Dynamically get properties from the underlying resource.

Parameters

string $key

Return Value

mixed

at line 63
mixed __call(string $method, array $parameters)

Dynamically pass method calls to the underlying resource.

Parameters

string $method
array $parameters

Return Value

mixed

at line 74
ApiResponse getResponse()

No description

Return Value

ApiResponse

at line 79
ApiRequest getRequest()

No description

Return Value

ApiRequest

at line 87
static ApiResource make(mixed ...$parameters)

Create a new resource instance.

Parameters

mixed ...$parameters

Return Value

ApiResource

at line 95
array resolve()

Resolve the resource to an array.

Return Value

array

at line 103
array toArray()

Transform the resource into an array.

Return Value

array

at line 111
string toJson(int $options = 0)

Convert the resource to its JSON representation.

Parameters

int $options

Return Value

string

at line 119
mixed jsonSerialize()

Prepare the resource for JSON serialization.

Return Value

mixed

at line 127
bool offsetExists(mixed $offset)

Implementation of ArrayAccess::offsetExists.

Parameters

mixed $offset

Return Value

bool

at line 135
mixed offsetGet(mixed $offset)

Implementation of ArrayAccess::offsetGet.

Parameters

mixed $offset

Return Value

mixed

at line 143
void offsetSet(mixed $offset, mixed $value)

Implementation of ArrayAccess::offsetSet.

Parameters

mixed $offset
mixed $value

Return Value

void

at line 151
void offsetUnset(mixed $offset)

Implementation of ArrayAccess::offsetUnset.

Parameters

mixed $offset

Return Value

void