SlotFlow API Documentation

DimensionPriority
in package
implements EdgeOrderingPolicyInterface, SerializablePolicy

FinalYes

Orders edges by configured priority tiers on source-slot dimensions.

Table of Contents

Interfaces

EdgeOrderingPolicyInterface
Reorders candidate edges for one cascade step.
SerializablePolicy
Opt-in interface for policies that can be fully described as a plain array and reconstructed from it.

Properties

$priorities  : array<string|int, mixed>
$rankByDimensionValueCache  : array<non-empty-string, array<non-empty-string, int>>

Methods

__construct()  : mixed
fromDefinition()  : static
Reconstruct a policy instance from a previously serialized definition.
orderEdges()  : array<int, MovementEdge>
Order edges based on the defined dimension priorities.
toDefinition()  : array<string, mixed>
Return a JSON-serializable description of this policy.
compareSlots()  : int
getRankByDimensionValue()  : array<non-empty-string, array<non-empty-string, int>>
Build a rank map for each dimension, preserving pattern groups as priority tiers.

Properties

$rankByDimensionValueCache

private array<non-empty-string, array<non-empty-string, int>> $rankByDimensionValueCache = []

Methods

__construct()

public __construct(array<non-empty-string, array<int, non-empty-string>> $priorities) : mixed
Parameters
$priorities : array<non-empty-string, array<int, non-empty-string>>

fromDefinition()

Reconstruct a policy instance from a previously serialized definition.

public static fromDefinition(array<string|int, mixed> $data) : static
Parameters
$data : array<string|int, mixed>
Attributes
#[Override]
Return values
static

orderEdges()

Order edges based on the defined dimension priorities.

public orderEdges(FlowContext $ctx) : array<int, MovementEdge>

Edges are sorted by the rank of their 'from' slot's dimension values. If a dimension value is not found in the priority list, it is assigned a default rank of PHP_INT_MAX, ensuring it is treated as lowest priority.

Parameters
$ctx : FlowContext
Attributes
#[Override]
Return values
array<int, MovementEdge>

toDefinition()

Return a JSON-serializable description of this policy.

public toDefinition() : array<string, mixed>

Must include a 'type' key whose value uniquely identifies the class.

Attributes
#[Override]
Return values
array<string, mixed>

compareSlots()

private compareSlots(Slot $left, Slot $right, array<non-empty-string, array<non-empty-string, int>> $rankByDimensionValue) : int
Parameters
$left : Slot
$right : Slot
$rankByDimensionValue : array<non-empty-string, array<non-empty-string, int>>
Return values
int

getRankByDimensionValue()

Build a rank map for each dimension, preserving pattern groups as priority tiers.

private getRankByDimensionValue(SlotSpace $space) : array<non-empty-string, array<non-empty-string, int>>

Values matched by the same pattern share the same rank. This means a pattern like 'wh*' behaves as one priority tier, rather than imposing an arbitrary order between all concrete values it matches.

Parameters
$space : SlotSpace
Return values
array<non-empty-string, array<non-empty-string, int>>
On this page

Search results