class Registry

Manages a collection of named asset Mappers and provides a central point for retrieving Assets using qualified references (mapper:reference).

Includes a simple cache for resolved assets.

Constants

DefaultScope

private MaxCacheSize

Methods

void
addMapper(string $id, Mapper $mapper)

Registers an asset mapper under the given identifier.

getMapper(string $id = self::DefaultScope)

Returns the mapper registered under the given identifier.

getAsset(string|array $qualifiedRef, array $options = [])

Returns an Asset for the given qualified reference ('mapper:reference' or ['mapper', 'reference']).

Asset|null
tryGetAsset(string|array $qualifiedRef, array $options = [])

Returns an Asset for the given qualified reference, or null if not found.

Details

at line 29
void addMapper(string $id, Mapper $mapper)

Registers an asset mapper under the given identifier.

Parameters

string $id
Mapper $mapper

Return Value

void

Exceptions

InvalidArgumentException

at line 42
Mapper getMapper(string $id = self::DefaultScope)

Returns the mapper registered under the given identifier.

Parameters

string $id

Return Value

Mapper

Exceptions

InvalidArgumentException

at line 54
Asset getAsset(string|array $qualifiedRef, array $options = [])

Returns an Asset for the given qualified reference ('mapper:reference' or ['mapper', 'reference']).

Parameters

string|array $qualifiedRef
array $options

passed to the mapper

Return Value

Asset

Exceptions

AssetNotFoundException

at line 93
Asset|null tryGetAsset(string|array $qualifiedRef, array $options = [])

Returns an Asset for the given qualified reference, or null if not found.

Parameters

string|array $qualifiedRef
array $options

passed to the mapper

Return Value

Asset|null