Documentation

ResourceResponse
in package
implements Responsable

Interfaces, Classes and Traits

Responsable

Table of Contents

$resource  : mixed
The underlying resource.
__construct()  : void
Create a new resource response.
toResponse()  : JsonResponse
Create an HTTP response that represents the object.
calculateStatus()  : int
Calculate the appropriate status code for the response.
haveAdditionalInformationAndDataIsUnwrapped()  : bool
Determine if "with" data has been added and our data is unwrapped.
haveDefaultWrapperAndDataIsUnwrapped()  : bool
Determine if we have a default wrapper and the given data is unwrapped.
wrap()  : array<string|int, mixed>
Wrap the given data if necessary.
wrapper()  : string
Get the default data wrapper for the resource.

Properties

Methods

__construct()

Create a new resource response.

public __construct(mixed $resource) : void
Parameters
$resource : mixed
Return values
void

calculateStatus()

Calculate the appropriate status code for the response.

protected calculateStatus() : int
Return values
int

haveAdditionalInformationAndDataIsUnwrapped()

Determine if "with" data has been added and our data is unwrapped.

protected haveAdditionalInformationAndDataIsUnwrapped(array<string|int, mixed> $data, array<string|int, mixed> $with, array<string|int, mixed> $additional) : bool
Parameters
$data : array<string|int, mixed>
$with : array<string|int, mixed>
$additional : array<string|int, mixed>
Return values
bool

haveDefaultWrapperAndDataIsUnwrapped()

Determine if we have a default wrapper and the given data is unwrapped.

protected haveDefaultWrapperAndDataIsUnwrapped(array<string|int, mixed> $data) : bool
Parameters
$data : array<string|int, mixed>
Return values
bool

wrap()

Wrap the given data if necessary.

protected wrap(array<string|int, mixed> $data[, array<string|int, mixed> $with = [] ][, array<string|int, mixed> $additional = [] ]) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed>
$with : array<string|int, mixed> = []
$additional : array<string|int, mixed> = []
Return values
array<string|int, mixed>

wrapper()

Get the default data wrapper for the resource.

protected wrapper() : string
Return values
string

Search results