ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\TermsOfService\UserSettings Class Reference
+ Inheritance diagram for ILIAS\TermsOfService\UserSettings:
+ Collaboration diagram for ILIAS\TermsOfService\UserSettings:

Public Member Functions

 __construct (private readonly ilObjUser $user, private readonly SelectSetting $user_pref, private readonly Refinery $refinery)
 
 withdrawalRequested ()
 
 agreeDate ()
 
 withdrawalRequested ()
 
 agreeDate ()
 

Private Member Functions

 setting (Convert $convert)
 
 convert ()
 

Detailed Description

Definition at line 32 of file UserSettings.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\TermsOfService\UserSettings::__construct ( private readonly ilObjUser  $user,
private readonly SelectSetting  $user_pref,
private readonly Refinery  $refinery 
)

Definition at line 34 of file UserSettings.php.

38 {
39 }

Member Function Documentation

◆ agreeDate()

ILIAS\TermsOfService\UserSettings::agreeDate ( )
Returns
Setting<?DateTimeImmutable>

Implements ILIAS\LegalDocuments\ConsumerToolbox\UserSettings.

Definition at line 52 of file UserSettings.php.

52 : Setting
53 {
54 return $this->setting($this->convert());
55 }

References ILIAS\TermsOfService\UserSettings\convert(), and ILIAS\TermsOfService\UserSettings\setting().

+ Here is the call graph for this function:

◆ convert()

ILIAS\TermsOfService\UserSettings::convert ( )
private

Definition at line 68 of file UserSettings.php.

68 : Convert
69 {
70 $custom = $this->refinery->custom()->transformation(...);
71 $null_or = fn($next) => $this->refinery->byTrying([$this->refinery->null(), $next]);
72
73 return new Convert(
74 $null_or($this->refinery->to()->dateTime()),
75 $null_or($custom(fn(DateTimeImmutable $d): string => $d->format('Y-m-d H:i:s')))
76 );
77 }

References Vendor\Package\$d, and ILIAS\Repository\refinery().

Referenced by ILIAS\TermsOfService\UserSettings\agreeDate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setting()

ILIAS\TermsOfService\UserSettings::setting ( Convert  $convert)
private

Definition at line 57 of file UserSettings.php.

57 : Setting
58 {
59 return new Setting(
60 fn() => $convert->fromString()->transform($this->user->getAgreeDate()),
61 function ($value) use ($convert): void {
62 $this->user->setAgreeDate($convert->toString()->transform($value));
63 $this->user->update();
64 }
65 );
66 }

References ILIAS\LegalDocuments\ConsumerToolbox\Convert\fromString(), ILIAS\LegalDocuments\ConsumerToolbox\Convert\toString(), and ILIAS\Repository\user().

Referenced by ILIAS\TermsOfService\UserSettings\agreeDate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ withdrawalRequested()

ILIAS\TermsOfService\UserSettings::withdrawalRequested ( )
Returns
Setting<bool>

Implements ILIAS\LegalDocuments\ConsumerToolbox\UserSettings.

Definition at line 44 of file UserSettings.php.

44 : Setting
45 {
46 return $this->user_pref->typed('consent_withdrawal_requested', fn(Marshal $m) => $m->boolean());
47 }

References ILIAS\LegalDocuments\ConsumerToolbox\Marshal\boolean().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: