19 declare(strict_types=1);
44 private readonly
Provide $legal_documents,
45 private readonly
Clock $clock
47 $this->matching_document = $this->
lazy(fn() => $this->legal_documents->document()->chooseDocumentFor($this->
user));
70 return $this->user_settings->withdrawalRequested();
78 return $this->user_settings->agreeDate();
83 $false = fn() =>
new Ok(
false);
93 $true = fn() =>
new Ok(
true);
94 $db = $this->legal_documents->history();
96 return $this->
settings->validateOnLogin()->value()
97 &&
$db->currentDocumentOfAcceptedVersion($this->
user)->map($this->
doesntMatch(...))->except($true)->value();
102 return !$this->legal_documents->document()->documentMatches($document, $this->
user);
107 return ($this->matching_document)();
113 new Error(
'User never agreed.') :
114 $this->legal_documents->history()->acceptedVersion($this->
user);
119 $this->legal_documents->history()->acceptDocument(
123 $this->
agreeDate()->update($this->clock->now());
128 $this->legal_documents->history()->acceptDocument(
130 current($this->legal_documents->document()->repository()->all())
144 public function format(
string $format_string): string
146 return str_ireplace(
'[BR]',
"\n", sprintf(
148 $this->
user->getFullname(),
149 $this->
user->getLogin(),
150 $this->
user->getExternalAccount()
161 $auth_mode = $this->
user->getAuthMode();
162 return $auth_mode ===
'default' ?
163 $this->
settings->authMode()->value() :
169 return !$this->legal_documents->history()->alreadyAccepted($this->
user, $document);
179 $proc =
function () use (&$proc, $create_value) {
180 $value = $create_value();
181 $proc = fn() => $value;
184 return function () use (&$proc) {
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
A result encapsulates a value or an error and simplifies the handling of those.