ApiResourceManager
in package
Class ApiResourceManager.
Table of Contents
Properties
- $container : array<string, array<string, array<string, string>>>
- $majorVersion : string
- $version : string
- $cached : array<string, mixed>
- $cacheStore : Repository
- $request : Request
Methods
- asDetail() : JsonResource|null
- asEmbed() : JsonResource|null
- asItem() : JsonResource|null
- asJson() : array<string|int, mixed>|null
- asResource() : JsonResource|null
- detail() : array<string|int, mixed>|null
- embed() : array<string|int, mixed>|null
- embeds() : array<string|int, mixed>|null
- getHttpResourceClass() : string
- getItem() : mixed
- getMajorVersion() : string
- getVersion() : string
- item() : array<string|int, mixed>|null
- items() : array<string|int, mixed>|null
- pickNearestVersion() : string|null
- setVersion() : void
- toCollection() : ResourceCollection<string|int, JsonResource>|null
- toItem() : JsonResource|null
- toResource() : JsonResource|null
- user() : array<string|int, mixed>|null
- loadResourceVersions() : void
- pickHttpResourceVersion() : string
Properties
$container
protected
array<string, array<string, array<string, string>>>
$container
= []
$majorVersion
protected
string
$majorVersion
= 'v1'
$version
protected
string
$version
= 'v1'
$cached
private
array<string, mixed>
$cached
= []
$cacheStore
private
Repository
$cacheStore
$request
private
Request
$request
Methods
asDetail()
public
asDetail(mixed $entity[, bool $checkPrivacy = 'view' ]) : JsonResource|null
Parameters
- $entity : mixed
- $checkPrivacy : bool = 'view'
Tags
Return values
JsonResource|nullasEmbed()
public
asEmbed(mixed $entity[, mixed $checkPrivacy = 'view' ]) : JsonResource|null
Parameters
- $entity : mixed
- $checkPrivacy : mixed = 'view'
Tags
Return values
JsonResource|nullasItem()
public
asItem(mixed $entity[, mixed $checkPrivacy = true ]) : JsonResource|null
Parameters
- $entity : mixed
- $checkPrivacy : mixed = true
Tags
Return values
JsonResource|nullasJson()
public
asJson( $entity, string $variant[, mixed $checkPrivacy = 'view' ]) : array<string|int, mixed>|null
Parameters
Tags
Return values
array<string|int, mixed>|nullasResource()
public
asResource(mixed|null $entity, string $variant[, mixed $checkPrivacy = 'view' ]) : JsonResource|null
Parameters
- $entity : mixed|null
- $variant : string
-
item, embed, detail
- $checkPrivacy : mixed = 'view'
Tags
Return values
JsonResource|nulldetail()
public
detail(mixed $entity[, bool $checkPrivacy = 'view' ]) : array<string|int, mixed>|null
Parameters
- $entity : mixed
- $checkPrivacy : bool = 'view'
Tags
Return values
array<string|int, mixed>|nullembed()
public
embed(mixed $entity[, bool $checkPrivacy = 'view' ]) : array<string|int, mixed>|null
Parameters
- $entity : mixed
- $checkPrivacy : bool = 'view'
Tags
Return values
array<string|int, mixed>|nullembeds()
public
embeds(Collection $items[, mixed $checkPrivacy = 'view' ]) : array<string|int, mixed>|null
Parameters
- $items : Collection
- $checkPrivacy : mixed = 'view'
Return values
array<string|int, mixed>|nullgetHttpResourceClass()
public
getHttpResourceClass(string $type, string $variant) : string
Parameters
- $type : string
- $variant : string
Return values
stringgetItem()
public
getItem(mixed $alias, mixed $id) : mixed
Parameters
- $alias : mixed
- $id : mixed
getMajorVersion()
public
getMajorVersion() : string
Return values
stringgetVersion()
public
getVersion() : string
Return values
stringitem()
public
item(mixed $entity[, bool $checkPrivacy = 'view' ]) : array<string|int, mixed>|null
Parameters
- $entity : mixed
- $checkPrivacy : bool = 'view'
Tags
Return values
array<string|int, mixed>|nullitems()
public
items(Collection $items[, mixed $checkPrivacy = 'view' ]) : array<string|int, mixed>|null
Parameters
- $items : Collection
- $checkPrivacy : mixed = 'view'
Return values
array<string|int, mixed>|nullpickNearestVersion()
public
pickNearestVersion(array<string|int, string> $versions) : string|null
Parameters
- $versions : array<string|int, string>
Return values
string|nullsetVersion()
public
setVersion(string|null $version) : void
Parameters
- $version : string|null
Tags
toCollection()
public
toCollection() : ResourceCollection<string|int, JsonResource>|null
Return values
ResourceCollection<string|int, JsonResource>|nulltoItem()
public
toItem(mixed $alias, mixed $id[, mixed $checkPrivacy = 'view' ]) : JsonResource|null
Parameters
- $alias : mixed
- $id : mixed
- $checkPrivacy : mixed = 'view'
Return values
JsonResource|nulltoResource()
public
toResource(mixed $variant, mixed $alias, mixed $id[, mixed $checkPrivacy = 'view' ]) : JsonResource|null
Parameters
- $variant : mixed
- $alias : mixed
- $id : mixed
- $checkPrivacy : mixed = 'view'
Return values
JsonResource|nulluser()
public
user(mixed $entity[, bool $checkPrivacy = false ]) : array<string|int, mixed>|null
Parameters
- $entity : mixed
- $checkPrivacy : bool = false
Tags
Return values
array<string|int, mixed>|nullloadResourceVersions()
private
loadResourceVersions() : void
pickHttpResourceVersion()
private
pickHttpResourceVersion(string $type, string $variant, string $version) : string
Parameters
- $type : string
- $variant : string
- $version : string