l10n = $l10n; $this->timeFactory = $timeFactory; } public function run(string $date): PhishingDetectionResult { $now = $this->timeFactory->getDateTime('now'); try { $dt = $this->timeFactory->getDateTime($date); } catch (\Exception $e) { return new PhishingDetectionResult(PhishingDetectionResult::DATE_CHECK, false); } if ($dt > $now) { return new PhishingDetectionResult(PhishingDetectionResult::DATE_CHECK, true, $this->l10n->t('Sent date is in the future')); } return new PhishingDetectionResult(PhishingDetectionResult::DATE_CHECK, false); } }