SlotFlow API Documentation

MovementEngine
in package

FinalYes

Executes flows against quantity state via a pluggable solver.

Table of Contents

Properties

$solver  : ExecutionSolverInterface

Methods

__construct()  : mixed
Create one movement engine around the provided execution solver.
execute()  : MovementResult
Execute one flow for one subject.

Properties

Methods

execute()

Execute one flow for one subject.

public execute(QuantityState $inventory, SlotSpace $space, string|Flow $flow, int|float $quantity[, mixed $subject = null ][, array<string|int, mixed> $appContext = [] ][, array<string, scalar|null> $params = [] ]) : MovementResult

The quantity state passed in is not modified: the solver works against a private copy, and the movement is reported as events and deltas on the returned result. That makes execution a pure computation — safe to run speculatively, to compare two flows against the same starting state, or to abandon on failure without leaving the caller's state half-moved.

To obtain the state that results from a movement, apply the result: $after = $engine->execute($before, ...)->applyTo($before);

Parameters
$inventory : QuantityState
$space : SlotSpace
$flow : string|Flow
$quantity : int|float
$subject : mixed = null
$appContext : array<string|int, mixed> = []
$params : array<string, scalar|null> = []
Return values
MovementResult
On this page

Search results