ILIAS
trunk Revision v11.0_alpha-1761-g6dbbfa7b760
◀ 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
DictionaryTransformation.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\Refinery\KindlyTo\Transformation
;
22
23
use
ILIAS\Refinery\DeriveApplyToFromTransform
;
24
use
ILIAS\Refinery\DeriveInvokeFromTransform
;
25
use
ILIAS\Refinery\Transformation
;
26
use
ILIAS\Refinery\ConstraintViolationException
;
27
28
class
DictionaryTransformation
implements
Transformation
29
{
30
use
DeriveApplyToFromTransform
;
31
use
DeriveInvokeFromTransform
;
32
33
private
Transformation
$transformation
;
34
35
public
function
__construct
(
Transformation
$transformation)
36
{
37
$this->transformation =
$transformation
;
38
}
39
44
public
function
transform
($from): array
45
{
46
if
(!is_array($from)) {
47
throw
new
ConstraintViolationException
(
48
sprintf(
'The value "%s" is no array.'
, var_export($from,
true
)),
49
'value_is_no_array'
,
50
$from
51
);
52
}
53
54
$result = [];
55
foreach
($from as $key => $value) {
56
if
(!(is_int($key) || is_string($key))) {
57
throw
new
ConstraintViolationException
(
58
'Key is not a string or int'
,
59
'key_is_no_string_or_int'
60
);
61
}
62
$transformedValue = $this->transformation->transform($value);
63
$result[(string) $key] = $transformedValue;
64
}
65
66
return
$result;
67
}
68
}
ILIAS\Refinery\DeriveInvokeFromTransform
trait DeriveInvokeFromTransform
Definition:
DeriveInvokeFromTransform.php:24
ILIAS\Refinery\DeriveApplyToFromTransform
trait DeriveApplyToFromTransform
Definition:
DeriveApplyToFromTransform.php:29
Transformation
ILIAS\Refinery\ConstraintViolationException
Definition:
ConstraintViolationException.php:29
ILIAS\Refinery\KindlyTo\Transformation\DictionaryTransformation
Definition:
DictionaryTransformation.php:28
ILIAS\Refinery\KindlyTo\Transformation\DictionaryTransformation\transform
transform($from)
Definition:
DictionaryTransformation.php:44
ILIAS\Refinery\Transformation
A transformation is a function from one datatype to another.
Definition:
Transformation.php:34
ILIAS\Refinery\KindlyTo\Transformation\DictionaryTransformation\__construct
__construct(Transformation $transformation)
Definition:
DictionaryTransformation.php:35
ConstraintViolationException
ILIAS\Refinery\KindlyTo\Transformation\DictionaryTransformation\$transformation
Transformation $transformation
Definition:
DictionaryTransformation.php:33
ILIAS\Refinery\KindlyTo\Transformation
Definition:
BooleanTransformation.php:21
components
ILIAS
Refinery
src
KindlyTo
Transformation
DictionaryTransformation.php
Generated on Sat Apr 12 2025 23:03:43 for ILIAS by
1.8.13 (using
Doxyfile
)