Skip to content
docsv0.1.0

DecisionSurfaceFactoryInterface

Builds the domain-specific {@see DecisionSurfaceInterface} for a process instance sitting at a gated state. Injected into {@see HumanGate} so the generic engine never needs to know what a process's domain entity is (a blog post, an invoice, a support ticket, ...) — only the consumer's factory implementation does. {@see HumanGate} calls {@see self::build()} with exactly the gate's outgoing transitions and the instance's current context (e.g. domain ids stamped at {@see ProcessInstance::start()} time), and wraps the result in a {@see PendingDecision}, whose constructor enforces the options<->transitions 1:1 invariant.

DecisionSurfaceFactoryInterface::build()

abstract public function build(Milpa\Orchestrator\ProcessInstance $instance, array $transitions, array $context): Milpa\Orchestrator\DecisionSurfaceInterface

Builds the decision surface for `$instance` sitting at a gated state.

Parameters

Parameters of build()
NameTypeDescription
$instanceMilpa\Orchestrator\ProcessInstance
$transitionslist<array{name: string, to: string}>the gate's outgoing transitions; the returned surface's {@see DecisionSurfaceInterface::options()} MUST match these names 1:1
$contextarray<string, mixed>the process instance's current context (accumulated event payload)