/**
* Create the metadata record if it does not exist.
*
* @param SessionInterface $session The session to create or update the metadata record for.
* @param User $user The user to associate with the record.
*
* @return void
*
* @since 4.0.0
* @throws \RuntimeException
*/
public function createOrUpdateRecord(SessionInterface $session, User $user)
{
$exists = $this->checkSessionRecordExists($session->getId());
// Do not try to touch the database if we can't determine the record state
if ($exists === self::$sessionRecordUnknown) {
return;
}
if ($exists === self::$sessionRecordDoesNotExist) {
$this->createSessionRecord($session, $user);
return;
}
$this->updateSessionRecord($session, $user);
}