Loops & Branches
Loops
class NodeOne extends Node
{
public function __invoke(FirstEvent $event, WorkflowState $state): FirstEvent|SecondEvent
{
echo "\n- ".$event->firstMsg;
if (rand(0, 1) === 1) {
// Returning FirstEvent it will trigger another execution of NodeOne
return new FirstEvent("Running a loop on NodeOne");
}
return new SecondEvent("NodeOne complete, move forward");
}
}
Branches

Monitoring & Debugging
Last updated