dateTime = $dateTime; $this->configuration = $configuration; } /** * @return TrackingModeInterface[] */ public function getModes(): iterable { return [ new DefaultMode($this->dateTime, $this->configuration), new PunchInOutMode(), new DurationOnlyMode($this->dateTime, $this->configuration), new DurationFixedBeginMode($this->dateTime, $this->configuration), ]; } public function getActiveMode(): TrackingModeInterface { $trackingMode = $this->configuration->getTrackingMode(); foreach ($this->getModes() as $mode) { if ($mode->getId() === $trackingMode) { return $mode; } } throw new ServiceNotFoundException($trackingMode); } }