ILIAS
trunk Revision v11.0_alpha-1744-gb0451eebef4
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
+
Variables
$
c
e
g
h
j
l
m
p
s
t
u
v
+
Enumerations
a
c
e
f
i
j
l
m
n
o
p
r
s
t
u
v
z
+
Enumerator
a
c
d
e
f
g
i
l
m
n
o
p
q
s
t
u
v
y
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Ö
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Ö
Enumerations
Enumerator
+
Files
File List
+
Globals
+
All
$
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
z
+
Functions
a
b
c
d
e
f
g
h
i
m
n
p
r
s
t
u
v
+
Variables
$
a
c
e
g
h
i
m
n
o
p
r
s
t
u
v
z
Enumerations
Enumerator
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Enumerations
Enumerator
Modules
Pages
UserSettings.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\TermsOfService
;
22
23
use
ILIAS\LegalDocuments\ConsumerToolbox\UserSettings
as
UserSettingsInterface
;
24
use
ILIAS\LegalDocuments\ConsumerToolbox\Marshal
;
25
use
ilObjUser
;
26
use
ILIAS\LegalDocuments\ConsumerToolbox\SelectSetting
;
27
use
ILIAS\LegalDocuments\ConsumerToolbox\Convert
;
28
use
ILIAS\LegalDocuments\ConsumerToolbox\Setting
;
29
use
ILIAS\Refinery\Factory
as
Refinery
;
30
use
DateTimeImmutable
;
31
32
class
UserSettings
implements
UserSettingsInterface
33
{
34
public
function
__construct
(
35
private
readonly
ilObjUser
$user,
36
private
readonly
SelectSetting
$user_pref,
37
private
readonly
Refinery
$refinery
38
) {
39
}
40
44
public
function
withdrawalRequested
():
Setting
45
{
46
return
$this->user_pref->typed(
'consent_withdrawal_requested'
, fn(
Marshal
$m) => $m->
boolean
());
47
}
48
52
public
function
agreeDate
():
Setting
53
{
54
return
$this->
setting
($this->
convert
());
55
}
56
57
private
function
setting
(
Convert
$convert):
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
}
67
68
private
function
convert
():
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
}
78
}
ILIAS\TermsOfService
Definition:
Consumer.php:21
ILIAS\UI\examples\Layout\Page\Standard\$refinery
$refinery
Definition:
ui.php:137
DateTimeImmutable
ILIAS\TermsOfService\UserSettings\convert
convert()
Definition:
UserSettings.php:68
Convert
ILIAS\TermsOfService\UserSettings\setting
setting(Convert $convert)
Definition:
UserSettings.php:57
ILIAS\TermsOfService\UserSettings
Definition:
UserSettings.php:32
ILIAS\LegalDocuments\ConsumerToolbox\Convert\toString
toString()
Definition:
Convert.php:38
ILIAS\TermsOfService\UserSettings\agreeDate
agreeDate()
Definition:
UserSettings.php:52
ILIAS\Repository\user
user()
Definition:
trait.GlobalDICDomainServices.php:66
Marshal
ILIAS\LegalDocuments\ConsumerToolbox\Marshal\boolean
boolean()
Definition:
Marshal.php:47
Vendor\Package\$d
$d
Definition:
example_cleaned.php:49
Setting
ILIAS\Repository\refinery
refinery()
Definition:
trait.GlobalDICDomainServices.php:76
ILIAS\LegalDocuments\ConsumerToolbox\Marshal
Definition:
Marshal.php:29
ILIAS\TermsOfService\UserSettings\__construct
__construct(private readonly ilObjUser $user, private readonly SelectSetting $user_pref, private readonly Refinery $refinery)
Definition:
UserSettings.php:34
ilObjUser
Factory
UserSettings
SelectSetting
ILIAS\LegalDocuments\ConsumerToolbox\Convert\fromString
fromString()
Definition:
Convert.php:33
ILIAS\TermsOfService\UserSettings\withdrawalRequested
withdrawalRequested()
Definition:
UserSettings.php:44
ILIAS\LegalDocuments\ConsumerToolbox\Setting
A
Definition:
Setting.php:28
ILIAS\LegalDocuments\ConsumerToolbox\SelectSetting
Definition:
SelectSetting.php:25
ILIAS\LegalDocuments\ConsumerToolbox\Convert
Definition:
Convert.php:25
components
ILIAS
TermsOfService
classes
UserSettings.php
Generated on Tue Apr 8 2025 23:03:12 for ILIAS by
1.8.13 (using
Doxyfile
)