class JsonApiDocument implements JsonSerializable

Traits

Class JsonApiLinkTrait
Class JsonApiMetaTrait

Properties

$links The links array. from JsonApiLinkTrait
protected array $meta The meta data array. from JsonApiMetaTrait
protected array $included The included array.
protected array $errors The errors array.
protected array $jsonApi The jsonapi array.
protected JsonApiElementInterface $data The data object.

Methods

array
getLinks()

Get the links.

$this
setLinks(array $links)

Set the links.

$this
addLink(string $key, string $value)

Add a link.

array
getMeta()

Get the meta.

$this
setMeta(array $meta)

Set the meta data array.

$this
addMeta(string $key, string $value)

Add meta data.

__construct(JsonApiElementInterface $data = null)

No description

getIncluded(JsonApiElementInterface $element, bool $includeParent = false)

Get included resources.

mergeResource(array $resources, JsonApiOne $newResource)

No description

$this
setData(JsonApiElementInterface $element)

Set the data object.

$this
setErrors(array $errors)

Set the errors array.

$this
setJsonApi(array $jsonApi)

Set the jsonApi array.

array
toArray()

Map everything to arrays.

string
__toString()

Map to string.

array
jsonSerialize()

Serialize for JSON usage.

array
deserialize(null $string = null)

No description

mixed|null
denormalize(JsonApiElementInterface $element, $decoded, null $includedData = null)

No description

array
extractAttributes($object, JsonApiElementInterface $resource)

No description

bool
isAllowedAttribute($attributeName, $serializerAttributes)

No description

getData()

No description

Details

Get the links.

Return Value

array

Set the links.

Parameters

array $links

Return Value

$this

Add a link.

Parameters

string $key
string $value

Return Value

$this

in JsonApiMetaTrait at line 23
array getMeta()

Get the meta.

Return Value

array

in JsonApiMetaTrait at line 35
$this setMeta(array $meta)

Set the meta data array.

Parameters

array $meta

Return Value

$this

in JsonApiMetaTrait at line 49
$this addMeta(string $key, string $value)

Add meta data.

Parameters

string $key
string $value

Return Value

$this

at line 56
__construct(JsonApiElementInterface $data = null)

Parameters

JsonApiElementInterface $data

at line 82
protected JsonApiOne[] getIncluded(JsonApiElementInterface $element, bool $includeParent = false)

Get included resources.

Parameters

JsonApiElementInterface $element
bool $includeParent

Return Value

JsonApiOne[]

at line 127
protected JsonApiOne[] mergeResource(array $resources, JsonApiOne $newResource)

Parameters

array $resources
JsonApiOne $newResource

Return Value

JsonApiOne[]

at line 147
$this setData(JsonApiElementInterface $element)

Set the data object.

Parameters

JsonApiElementInterface $element

Return Value

$this

at line 159
$this setErrors(array $errors)

Set the errors array.

Parameters

array $errors

Return Value

$this

at line 171
$this setJsonApi(array $jsonApi)

Set the jsonApi array.

Parameters

array $jsonApi

Return Value

$this

at line 181
array toArray()

Map everything to arrays.

Return Value

array

at line 213
string __toString()

Map to string.

Return Value

string

at line 222
array jsonSerialize()

Serialize for JSON usage.

Return Value

array

at line 233
array deserialize(null $string = null)

Parameters

null $string

Return Value

array

Exceptions

Exception

at line 289
protected mixed|null denormalize(JsonApiElementInterface $element, $decoded, null $includedData = null)

Parameters

JsonApiElementInterface $element
$decoded
null $includedData

Return Value

mixed|null

Exceptions

Exception

at line 344
protected array extractAttributes($object, JsonApiElementInterface $resource)

Parameters

$object
JsonApiElementInterface $resource

Return Value

array

at line 395
bool isAllowedAttribute($attributeName, $serializerAttributes)

Parameters

$attributeName
$serializerAttributes

Return Value

bool

at line 527
JsonApiElementInterface getData()