ILIAS
release_6 Revision v6.24-5-g0c8bfefb3b8
◀ 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
s
t
w
+
Functions
_
a
b
c
f
g
h
i
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
15
class
DictionaryTransformation
implements
Transformation
16
{
17
use
DeriveApplyToFromTransform
;
18
22
private
$transformation
;
23
27
public
function
__construct
(
Transformation
$transformation
)
28
{
29
$this->transformation =
$transformation
;
30
}
31
35
public
function
transform
($from)
36
{
37
if
(
false
=== is_array($from)) {
38
throw
new
ConstraintViolationException
(
39
'The value MUST be an array'
,
40
'not_array'
41
);
42
}
43
44
$result
= array();
45
foreach
($from as $key => $value) {
46
if
(
false
=== is_string($key)) {
47
throw
new
ConstraintViolationException
(
48
'The key "%s" is NOT a string'
,
49
'key_is_not_a_string'
50
);
51
}
52
53
$transformedValue = $this->transformation->transform($value);
54
$result
[$key] = $transformedValue;
55
}
56
57
return
$result
;
58
}
59
63
public
function
__invoke
($from)
64
{
65
return
$this->
transform
($from);
66
}
67
}
ILIAS\Refinery\To\Transformation\DictionaryTransformation\__invoke
__invoke($from)
Transformations should be callable.This MUST do the same as transform.
Definition:
DictionaryTransformation.php:63
$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:35
ILIAS\Refinery\To\Transformation\DictionaryTransformation\__construct
__construct(Transformation $transformation)
Definition:
DictionaryTransformation.php:27
Transformation
ILIAS\Refinery\DeriveApplyToFromTransform
trait DeriveApplyToFromTransform
Definition:
DeriveApplyToFromTransform.php:13
ILIAS\Refinery\To\Transformation
Definition:
BooleanTransformation.php:10
ILIAS\Refinery\ConstraintViolationException
Definition:
ConstraintViolationException.php:14
ILIAS\Refinery\To\Transformation\DictionaryTransformation
Definition:
DictionaryTransformation.php:15
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:22
ConstraintViolationException
src
Refinery
To
Transformation
DictionaryTransformation.php
Generated on Sat Apr 5 2025 20:01:38 for ILIAS by
1.8.13 (using
Doxyfile
)