public function refreshOptInHashForUser(int
$userId, int
$optInId, DateTimeInterface
$lastSentDate): string
{ $hash =
$this->
getHashForOptInId($optInId,
$lastSentDate);
$this->
updateOptInEntry($optInId,
$hash);
$this->
updateUserSentDate($userId);
return $hash;
} protected function getHashForOptInId(int
$optInId, DateTimeInterface
$lastSentDate): string
{ if ($this->
isDateInLast15Minutes($lastSentDate)) { $sql = <<<'SQL'
SELECT hash
FROM s_core_optin
WHERE id = :id;
SQL;
return (string) $this->connection->
fetchColumn($sql,
[':id' =>
$optInId]);
} return Random::
getAlphanumericString(32
);
}