Skip to content
docsv0.1.0

StateSnapshot

A component instance's full state at one point in time — the value every render-target and transport in this package passes around instead of a live component object, since components themselves are stateless between calls (see {@see \Milpa\Live\Contracts\Component\ComponentDefinitionInterface}). `$data` and `$meta` are conventionally distinguished as: `$data` is the component's primary, user-mutable value(s); `$meta` is configuration/ display state set at mount time (labels, flags, options) that {@see \Milpa\Live\Contracts\Component\ComponentDefinitionInterface::handle()} does not normally rewrite. Nothing in this class enforces that split — it is a convention components and renderers follow.

StateSnapshot::__construct()

public function __construct(string $componentId, string $componentName, string $version, array $data = [], array $meta = []):

Parameters

Parameters of __construct()
NameTypeDescription
$componentIdstringThe component instance's unique id.
$componentNamestringThe component's registered name (its {@see ComponentContract::$name}).
$versionstringThe contract version this snapshot was mounted under (its {@see ComponentContract::$contractVersion}).
$dataarray<string, mixed>Primary, user-mutable state.
$metaarray<string, mixed>Mount-time configuration/display state.