final class ComponentRegistry (View source)

Maps view-facing component names to container services and resolves them on demand.

Registrations may be extended or replaced before a component is resolved.

Methods

Initializes the registry with the container used for lazy component resolution.

void
register(string $name, string $componentClass)

Registers or replaces the service class resolved for a component name.

void
bool
has(string $name)

Reports whether a component name is currently registered.

bool
object
get(string $name, string|null $expectedClass = null)

Resolves a registered component and optionally verifies its expected implementation type.

object

Resolves the registered breadcrumb component.

Resolves the registered request-aware pagination component.

meta()

Resolves the registered metadata component.

array
all()

Returns the current component-name to service-class mapping.

array

Details

__construct

__construct(ContainerInterface $container)

Initializes the registry with the container used for lazy component resolution.

Parameters

ContainerInterface $container

register

void register(string $name, string $componentClass)

Registers or replaces the service class resolved for a component name.

Parameters

string $name
string $componentClass

Return Value

void

has

bool has(string $name)

Reports whether a component name is currently registered.

Parameters

string $name

Return Value

bool

get

object get(string $name, string|null $expectedClass = null)

Resolves a registered component and optionally verifies its expected implementation type.

Parameters

string $name
string|null $expectedClass

Return Value

object

Exceptions

RuntimeException

breadcrumb

Resolves the registered breadcrumb component.

Return Value

BreadcrumbComponent

pagination

Resolves the registered request-aware pagination component.

Return Value

PaginationComponent

meta

Resolves the registered metadata component.

Return Value

MetaComponent

all

array all()

Returns the current component-name to service-class mapping.

Return Value

array