$cronjobServices */ public function __construct( readonly private iterable $cronjobServices, ) {} public function getByName(string $name): CronjobInterface { /** @var CronjobInterface $cronService */ foreach ($this->cronjobServices as $cronService){ if ($cronService->name() === $name) { return $cronService; } } throw new RuntimeException('no cronjob service found with this name : ' . $name); } /** * @return iterable */ public function getAll(): iterable { return $this->cronjobServices; } }