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 a new asset mapper under a specific identifier.

getMapper(string $id = self::DefaultScope)

Retrieves a registered asset mapper by its identifier.

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

Retrieves an Asset instance using a qualified reference. Accepts either 'mapper:reference' or ['mapper', 'reference'].

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

Attempts to retrieve an Asset instance using a qualified reference, but returns null if not found.

Details

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

Registers a new asset mapper under a specific identifier.

Parameters

string $id
Mapper $mapper

Return Value

void

Exceptions

InvalidArgumentException

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

Retrieves a registered asset mapper by its identifier.

Parameters

string $id

Return Value

Mapper

Exceptions

InvalidArgumentException

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

Retrieves an Asset instance using a qualified reference. Accepts either 'mapper:reference' or ['mapper', 'reference'].

Options passed directly to the underlying Mapper::getAsset() method.

Parameters

string|array $qualifiedRef
array $options

Return Value

Asset

Exceptions

AssetNotFoundException

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

Attempts to retrieve an Asset instance using a qualified reference, but returns null if not found.

Accepts either 'mapper:reference' or ['mapper', 'reference']. Options passed directly to the underlying Mapper::getAsset() method.

Parameters

string|array $qualifiedRef
array $options

Return Value

Asset|null