ILIAS
release_7 Revision v7.30-3-g800a261c036
◀ 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
p
r
s
t
w
+
Functions
_
a
b
c
f
g
h
i
r
s
t
w
+
Variables
$
c
d
e
f
g
h
j
l
m
p
s
t
+
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
q
r
s
t
u
v
w
x
z
+
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
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Modules
Pages
DictionaryTransformation.php
Go to the documentation of this file.
1
<?php
2
declare(strict_types=1);
3
/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
9
namespace
ILIAS\Refinery\To\Transformation
;
10
11
use
ILIAS\Refinery\DeriveApplyToFromTransform
;
12
use
ILIAS\Refinery\Transformation
;
13
use
ILIAS\Refinery\ConstraintViolationException
;
14
use
ILIAS\Refinery\DeriveInvokeFromTransform
;
15
16
class
DictionaryTransformation
implements
Transformation
17
{
18
use
DeriveApplyToFromTransform
;
19
use
DeriveInvokeFromTransform
;
20
24
private
$transformation
;
25
29
public
function
__construct
(
Transformation
$transformation
)
30
{
31
$this->transformation =
$transformation
;
32
}
33
37
public
function
transform
($from)
38
{
39
if
(
false
=== is_array($from)) {
40
throw
new
ConstraintViolationException
(
41
'The value MUST be an array'
,
42
'not_array'
43
);
44
}
45
46
$result
= array();
47
foreach
($from as $key => $value) {
48
if
(
false
=== is_string($key)) {
49
throw
new
ConstraintViolationException
(
50
'The key "%s" is NOT a string'
,
51
'key_is_not_a_string'
52
);
53
}
54
55
$transformedValue = $this->transformation->transform($value);
56
$result
[$key] = $transformedValue;
57
}
58
59
return
$result
;
60
}
61
}
$result
$result
Definition:
CleanUpTest.php:463
ILIAS\Refinery\To\Transformation\DictionaryTransformation\transform
transform($from)
Perform the transformation.Please use this for transformations. It's more performant than calling inv...
Definition:
DictionaryTransformation.php:37
ILIAS\Refinery\To\Transformation\DictionaryTransformation\__construct
__construct(Transformation $transformation)
Definition:
DictionaryTransformation.php:29
Transformation
ILIAS\Refinery\DeriveApplyToFromTransform
trait DeriveApplyToFromTransform
Definition:
DeriveApplyToFromTransform.php:13
ILIAS\Refinery\To\Transformation
Definition:
BooleanTransformation.php:10
ILIAS\Refinery\DeriveInvokeFromTransform
trait DeriveInvokeFromTransform
Definition:
DeriveInvokeFromTransform.php:13
ILIAS\Refinery\ConstraintViolationException
Definition:
ConstraintViolationException.php:14
ILIAS\Refinery\To\Transformation\DictionaryTransformation
Definition:
DictionaryTransformation.php:16
ILIAS\Refinery\Transformation
A transformation is a function from one datatype to another.
Definition:
Transformation.php:17
ILIAS\Refinery\To\Transformation\DictionaryTransformation\$transformation
$transformation
Definition:
DictionaryTransformation.php:24
ConstraintViolationException
src
Refinery
To
Transformation
DictionaryTransformation.php
Generated on Sun Apr 13 2025 21:01:49 for ILIAS by
1.8.13 (using
Doxyfile
)