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 declare(strict_types=1);
2
3
/* Copyright (c) 2020 Luka K. A. Stocker, Extended GPL, see docs/LICENSE */
4
5
namespace
ILIAS\Refinery\KindlyTo\Transformation
;
6
7
use
ILIAS\Refinery\DeriveApplyToFromTransform
;
8
use
ILIAS\Refinery\DeriveInvokeFromTransform
;
9
use
ILIAS\Refinery\Transformation
;
10
use
ILIAS\Refinery\ConstraintViolationException
;
11
12
class
DictionaryTransformation
implements
Transformation
13
{
14
use
DeriveApplyToFromTransform
;
15
use
DeriveInvokeFromTransform
;
16
17
private
$transformation
;
18
19
public
function
__construct
(
Transformation
$transformation
)
20
{
21
$this->transformation =
$transformation
;
22
}
23
27
public
function
transform
($from)
28
{
29
if
(!is_array($from)) {
30
throw
new
ConstraintViolationException
(
31
sprintf(
'The value "%s" is no array.'
, $from),
32
'value_is_no_array'
,
33
$from
34
);
35
}
36
37
$result
= [];
38
foreach
($from as $key => $value) {
39
if
(!is_string($key)) {
40
throw
new
ConstraintViolationException
(
41
'Key is not a string'
,
42
'key_is_no_string'
43
);
44
}
45
$transformedValue = $this->transformation->transform($value);
46
$result
[$key] = $transformedValue;
47
}
48
return
$result
;
49
}
50
}
$result
$result
Definition:
CleanUpTest.php:463
Transformation
ILIAS\Refinery\DeriveApplyToFromTransform
trait DeriveApplyToFromTransform
Definition:
DeriveApplyToFromTransform.php:13
ILIAS\Refinery\DeriveInvokeFromTransform
trait DeriveInvokeFromTransform
Definition:
DeriveInvokeFromTransform.php:13
ILIAS\Refinery\KindlyTo\Transformation\DictionaryTransformation\$transformation
$transformation
Definition:
DictionaryTransformation.php:17
ILIAS\Refinery\ConstraintViolationException
Definition:
ConstraintViolationException.php:14
ILIAS\Refinery\KindlyTo\Transformation\DictionaryTransformation
Definition:
DictionaryTransformation.php:12
ILIAS\Refinery\KindlyTo\Transformation\DictionaryTransformation\transform
transform($from)
Perform the transformation.Please use this for transformations. It's more performant than calling inv...
Definition:
DictionaryTransformation.php:27
ILIAS\Refinery\Transformation
A transformation is a function from one datatype to another.
Definition:
Transformation.php:17
ILIAS\Refinery\KindlyTo\Transformation\DictionaryTransformation\__construct
__construct(Transformation $transformation)
Definition:
DictionaryTransformation.php:19
ConstraintViolationException
ILIAS\Refinery\KindlyTo\Transformation
Definition:
BooleanTransformation.php:5
src
Refinery
KindlyTo
Transformation
DictionaryTransformation.php
Generated on Tue Apr 15 2025 21:01:36 for ILIAS by
1.8.13 (using
Doxyfile
)