DimensionPriority
in package
implements
EdgeOrderingPolicyInterface
FinalYes
Orders edges by configured priority tiers on source-slot dimensions.
Table of Contents
Interfaces
- EdgeOrderingPolicyInterface
- Reorders candidate edges for one cascade step.
Properties
- $priorities : array<string|int, mixed>
- $rankByDimensionValueCache : array<non-empty-string, array<non-empty-string, int>>
Methods
- __construct() : mixed
- orderEdges() : array<int, MovementEdge>
- Order edges based on the defined dimension priorities.
- getRankByDimensionValue() : array<non-empty-string, array<non-empty-string, int>>
- Build a rank map for each dimension, preserving pattern groups as priority tiers.
Properties
$priorities read-only
private
array<string|int, mixed>
$priorities
$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>>
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>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