blacklist); if ($reason !== null) { $fail($reason); } } /** * Grund der Ablehnung als Nutzertext, oder null, wenn der Text sauber ist. */ public static function reasonFor(string $value, BlacklistService $blacklist): ?string { if (preg_match(self::LINK_PATTERN, $value) === 1) { return __('Links sind in diesem Feld nicht erlaubt. Die Website gehört in das Feld „Website".'); } if (preg_match(self::EMAIL_PATTERN, $value) === 1) { return __('E-Mail-Adressen gehören in das dafür vorgesehene Feld.'); } if (preg_match(self::NOISE_PATTERN, $value) === 1 || preg_match(self::EMOJI_PATTERN, $value) === 1) { return __('Bitte ohne Sonderzeichen-Ketten oder Emoji-Reihen.'); } $word = $blacklist->find($value); if ($word !== null) { return __('Der Text enthält einen unzulässigen Begriff.'); } return null; } }