private bool
$shouldStop = false;
/**
* @param iterable<Schedule> $schedules
*/
public function __construct( private readonly array
$handlers,
array
$schedules,
private readonly ClockInterface
$clock =
new Clock(),
) { foreach ($schedules as $schedule) { $this->
addSchedule($schedule);
} } public function addSchedule(Schedule
$schedule): void
{ $this->
addMessageGenerator(new MessageGenerator($schedule, 'schedule_'.
$this->index++,
$this->clock
));
} public function addMessageGenerator(MessageGenerator
$generator): void
{ $this->generators
[] =
$generator;
}