Original file: src/Fsm/Contracts/ModularTransitionDefinition.php
The ModularTransitionDefinition interface defines a contract for modular transition definitions within a finite state machine (FSM) implementation. This interface provides a blueprint for creating transition definitions that can be extended or overridden, allowing for flexible and dynamic behavior in state transitions of a system. It encapsulates the fundamental attributes and actions associated with transitions between states in a FSM, enhancing the modularity and configurability of transition definitions.
getFromStatepublic function getFromState(): string|\Fsm\Contracts\FsmStateEnum|null;
string or an instance of FsmStateEnum, or null if there is no defined source state.null to indicate that the transition may be valid from any state, enhancing the flexibility of transition definitions.getToStatepublic function getToState(): string|\Fsm\Contracts\FsmStateEnum;
string or an instance of FsmStateEnum representing the target state.getEventpublic function getEvent(): string;
string that denotes the specific event associated with the transition.getDefinitionpublic function getDefinition(): array;
array<string, mixed>) containing various properties related to the transition.shouldOverridepublic function shouldOverride(): bool;
bool indicating whether the definition should replace an existing transition definition.true, the current definition will take precedence over any prior definitions that may conflict, enabling developers to enforce specific behaviors in their state transitions.getPrioritypublic function getPriority(): int;
int representing the priority level, with higher numbers indicating greater precedence.The ModularTransitionDefinition interface serves as a foundational component in the design of a finite state machine. By ensuring that all transition definitions adhere to this contract, developers can create a robust and flexible state transition system that is easy to extend and maintain. This documentation provides a clear understanding of the responsibilities and behaviors encapsulated within this interface, allowing for effective FSM implementation and manipulation in PHP applications.
How can I help you explore Laravel packages today?