ResolvesFlowParameters
Shared helpers for resolving `{param}` placeholders inside flow inputs.
A slot pattern may name an execute-time parameter instead of a literal value —
['loc' => '{location}'], 'sup.{own}.{state}' — and the solver substitutes it from
$context['params'] when the flow runs. One definition therefore serves every value of
that dimension: the same write_in flow receives into any warehouse, and a two-location
transfer names both ends as parameters ({from} → {to}), which no compile-time pattern
could express.
Table of Contents
Methods
- requireNonEmptyPatternValue() : string
- Refuse a pattern value that resolved to the empty string.
- resolvePatternParameters() : string|array<string|int, mixed>|null
- Resolve `{param}` placeholders inside slot-pattern inputs.
- resolvePatternValue() : string
- Resolve one slot-pattern value, and refuse a placeholder no parameter answered.
- resolveStringParameter() : string
- Resolve a single parameterized string using the provided scalar params.
Methods
requireNonEmptyPatternValue()
Refuse a pattern value that resolved to the empty string.
protected
requireNonEmptyPatternValue(string $resolved, int|string|null $dimension) : string
An empty value is not a wildcard: passed on it would match every value of the dimension and silently widen the movement, which is the opposite of what a caller supplying a parameter intends. Cheaper to refuse it here than to explain the resulting movement afterwards.
Parameters
- $resolved : string
- $dimension : int|string|null
Return values
stringresolvePatternParameters()
Resolve `{param}` placeholders inside slot-pattern inputs.
protected
resolvePatternParameters(string|array<int|string, string|null>|null $pattern, array<string, string> $params) : string|array<string|int, mixed>|null
Parameters
- $pattern : string|array<int|string, string|null>|null
- $params : array<string, string>
Return values
string|array<string|int, mixed>|nullresolvePatternValue()
Resolve one slot-pattern value, and refuse a placeholder no parameter answered.
protected
resolvePatternValue(string $value, array<string, string> $params, int|string|null $dimension) : string
Left alone, an unresolved {location} travels on as a literal dimension value and the
codec rejects it with "Value '{location}' is not valid for dimension 'loc'" — which reads
as a schema problem and sends the reader looking for a missing dimension value. The cause
is a caller that did not pass the parameter, so say that instead, and name it.
Parameters
- $value : string
- $params : array<string, string>
- $dimension : int|string|null
Return values
stringresolveStringParameter()
Resolve a single parameterized string using the provided scalar params.
protected
resolveStringParameter(string $value, array<string, string> $params) : string
Unmatched placeholders are returned as-is; callers that require resolution use resolvePatternValue(). Edge labels deliberately stay tolerant — an unresolved label simply matches no edge.
Parameters
- $value : string
- $params : array<string, string>