class LazyContextRepository implements ContextRepositoryInterface (View source)

Provides a context repository which uses context provider services.

Properties

protected string[] $contextProviderServiceIDs

The set of available context providers service IDs.

protected ContainerInterface $container

The service container.

protected ContextInterface[] $contexts

The statically cached contexts.

Methods

__construct(ContainerInterface $container, array $context_provider_service_ids)

Constructs a LazyContextRepository object.

getRuntimeContexts(array $context_ids)

Gets runtime context values for the given context IDs.

getAvailableContexts()

Gets all available contexts for the purposes of configuration.

Details

__construct(ContainerInterface $container, array $context_provider_service_ids)

Constructs a LazyContextRepository object.

Parameters

ContainerInterface $container

The current service container.

array $context_provider_service_ids

The set of the available context provider service IDs.

ContextInterface[] getRuntimeContexts(array $context_ids)

Gets runtime context values for the given context IDs.

Given that context providers might not return contexts for the given context IDs, it is also not guaranteed that the context repository returns contexts for all specified IDs.

Parameters

array $context_ids

Fully qualified context IDs, which looks like @{service_id}:{unqualified_context_id}, so for example node.node_route_context:node.

Return Value

ContextInterface[]

The determined contexts, keyed by the fully qualified context ID.

ContextInterface[] getAvailableContexts()

Gets all available contexts for the purposes of configuration.

Return Value

ContextInterface[]

All available contexts.