ILIAS
release_8 Revision v8.19
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
x
+
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
+
Variables
$
a
b
c
d
e
f
g
h
j
l
m
p
s
t
u
+
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
Ö
+
Files
File List
+
Globals
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
g
h
i
m
n
p
r
s
t
u
v
x
+
Variables
$
a
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Modules
Pages
BooleanTransformation.php
Go to the documentation of this file.
1
<?php
2
3
declare(strict_types=1);
4
21
namespace
ILIAS\Refinery\To\Transformation
;
22
23
use
ILIAS\Refinery\DeriveApplyToFromTransform
;
24
use
ILIAS\Refinery\Constraint
;
25
use
ILIAS\Refinery\DeriveInvokeFromTransform
;
26
use
ILIAS\Refinery\ProblemBuilder
;
27
use
UnexpectedValueException
;
28
29
class
BooleanTransformation
implements
Constraint
30
{
31
use
DeriveApplyToFromTransform
;
32
use
DeriveInvokeFromTransform
;
33
use
ProblemBuilder
;
34
38
public
function
transform
($from): bool
39
{
40
$this->
check
($from);
41
return
(
bool
) $from;
42
}
43
47
public
function
getError
(): string
48
{
49
return
'The value MUST be of type boolean.'
;
50
}
51
55
public
function
check
($value)
56
{
57
if
(!$this->
accepts
($value)) {
58
throw
new
UnexpectedValueException
($this->
getErrorMessage
($value));
59
}
60
61
return
null;
62
}
63
67
public
function
accepts
($value): bool
68
{
69
return
is_bool($value);
70
}
71
75
public
function
problemWith
($value): ?string
76
{
77
if
(!$this->
accepts
($value)) {
78
return
$this->
getErrorMessage
($value);
79
}
80
81
return
null;
82
}
83
}
ILIAS\Refinery\To\Transformation\BooleanTransformation\problemWith
problemWith($value)
Definition:
BooleanTransformation.php:75
ILIAS\Refinery\Constraint
A constraint encodes some resrtictions on values.
Definition:
Constraint.php:31
ILIAS\Refinery\ProblemBuilder
trait ProblemBuilder
Definition:
ProblemBuilder.php:27
ILIAS\Refinery\To\Transformation\BooleanTransformation\getError
getError()
Definition:
BooleanTransformation.php:47
ILIAS\Refinery\DeriveApplyToFromTransform
trait DeriveApplyToFromTransform
Definition:
DeriveApplyToFromTransform.php:29
ILIAS\Refinery\To\Transformation\BooleanTransformation
Definition:
BooleanTransformation.php:29
ILIAS\Refinery\To\Transformation
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition:
BooleanTransformation.php:21
UnexpectedValueException
ILIAS\Refinery\DeriveInvokeFromTransform
trait DeriveInvokeFromTransform
Definition:
DeriveInvokeFromTransform.php:27
ILIAS\Refinery\To\Transformation\BooleanTransformation\check
check($value)
Definition:
BooleanTransformation.php:55
ILIAS\Refinery\To\Transformation\BooleanTransformation\transform
transform($from)
Definition:
BooleanTransformation.php:38
ILIAS\Refinery\To\Transformation\BooleanTransformation\accepts
accepts($value)
Definition:
BooleanTransformation.php:67
ILIAS\Refinery\getErrorMessage
getErrorMessage($value)
Get the problem message.
Definition:
ProblemBuilder.php:48
Constraint
src
Refinery
To
Transformation
BooleanTransformation.php
Generated on Tue Apr 8 2025 22:03:03 for ILIAS by
1.8.13 (using
Doxyfile
)