ILIAS
trunk Revision v11.0_alpha-1749-g1a06bdef097
◀ 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
DateTimeTransformation.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\Refinery\To\Transformation
;
22
23
use
ILIAS\Refinery\DeriveApplyToFromTransform
;
24
use
ILIAS\Refinery\DeriveInvokeFromTransform
;
25
use
ILIAS\Refinery\Constraint
;
26
use
ILIAS\Refinery\ProblemBuilder
;
27
use
UnexpectedValueException
;
28
use
DateTimeImmutable
;
29
use
Exception
;
30
35
class
DateTimeTransformation
implements
Constraint
36
{
37
use
DeriveApplyToFromTransform
;
38
use
DeriveInvokeFromTransform
;
39
use
ProblemBuilder
;
40
41
private
string
$error
=
''
;
42
46
public
function
transform
($from):
DateTimeImmutable
47
{
48
$this->
check
($from);
49
return
new
DateTimeImmutable
($from);
50
}
51
55
public
function
getError
(): string
56
{
57
return
$this->error
;
58
}
59
63
public
function
check
($value)
64
{
65
if
(!$this->
accepts
($value)) {
66
throw
new
UnexpectedValueException
($this->
getErrorMessage
($value));
67
}
68
69
return
null
;
70
}
71
75
public
function
accepts
($value): bool
76
{
77
try
{
78
new
DateTimeImmutable
($value);
79
}
catch
(
Exception
$e
) {
80
$this->error = $e->getMessage();
81
return
false
;
82
}
83
return
true
;
84
}
85
89
public
function
problemWith
($value): ?string
90
{
91
if
(!$this->
accepts
($value)) {
92
return
$this->
getErrorMessage
($value);
93
}
94
95
return
null
;
96
}
97
}
DateTimeImmutable
ILIAS\Refinery\DeriveInvokeFromTransform
trait DeriveInvokeFromTransform
Definition:
DeriveInvokeFromTransform.php:24
ILIAS\Refinery\To\Transformation\DateTimeTransformation\problemWith
problemWith($value)
Definition:
DateTimeTransformation.php:89
ILIAS\Refinery\To\Transformation\DateTimeTransformation\check
check($value)
Definition:
DateTimeTransformation.php:63
ILIAS\Refinery\DeriveApplyToFromTransform
trait DeriveApplyToFromTransform
Definition:
DeriveApplyToFromTransform.php:29
ILIAS\Refinery\Constraint
A constraint encodes some resrtictions on values.
Definition:
Constraint.php:31
Vendor\Package\$e
$e
Definition:
example_cleaned.php:49
ILIAS\Refinery\To\Transformation
Definition:
BooleanTransformation.php:21
UnexpectedValueException
null
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Definition:
shib_logout.php:142
ILIAS\Refinery\To\Transformation\DateTimeTransformation\accepts
accepts($value)
Definition:
DateTimeTransformation.php:75
ILIAS\Refinery\getErrorMessage
getErrorMessage($value)
Definition:
ProblemBuilder.php:39
ILIAS\Refinery\ProblemBuilder
trait ProblemBuilder
Definition:
ProblemBuilder.php:26
ILIAS\Refinery\To\Transformation\DateTimeTransformation
Transform a string representing a datetime-value to php's DateTimeImmutable see https://www.php.net/manual/de/datetime.formats.php.
Definition:
DateTimeTransformation.php:35
ILIAS\Refinery\To\Transformation\DateTimeTransformation\transform
transform($from)
Definition:
DateTimeTransformation.php:46
ILIAS\Refinery\To\Transformation\DateTimeTransformation\$error
string $error
Definition:
DateTimeTransformation.php:41
ILIAS\Refinery\To\Transformation\DateTimeTransformation\getError
getError()
Definition:
DateTimeTransformation.php:55
Constraint
Exception
components
ILIAS
Refinery
src
To
Transformation
DateTimeTransformation.php
Generated on Wed Apr 9 2025 23:03:48 for ILIAS by
1.8.13 (using
Doxyfile
)