Skip to content
docsv0.1.0

InMemoryComponentRegistry

The default in-memory {@see ComponentRegistryInterface}: a plain `name => ComponentDefinitionInterface` map, with no persistence or discovery — callers {@see register()} every component explicitly.

InMemoryComponentRegistry::has()

public function has(string $name): bool

True when a component is registered under `$name`.

Parameters

Parameters of has()
NameTypeDescription
$namestring

InMemoryComponentRegistry::get()

public function get(string $name): Milpa\Live\Contracts\Component\ComponentDefinitionInterface

Returns the component registered under `$name`.

Parameters

Parameters of get()
NameTypeDescription
$namestring

Throws

\RuntimeException If no component is registered under `$name`.

InMemoryComponentRegistry::register()

public function register(string $name, Milpa\Live\Contracts\Component\ComponentDefinitionInterface $component): void

Registers `$component` under `$name`, replacing any component already registered under it.

Parameters

Parameters of register()
NameTypeDescription
$namestring
$componentMilpa\Live\Contracts\Component\ComponentDefinitionInterface