ILIAS
release_6 Revision v6.24-5-g0c8bfefb3b8
◀ ilDoc Overview
ListTransformation.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\ConstraintViolationException
;
12
use
ILIAS\Refinery\DeriveApplyToFromTransform
;
13
use
ILIAS\Refinery\Transformation
;
14
15
class
ListTransformation
implements
Transformation
16
{
17
use
DeriveApplyToFromTransform
;
21
private
$transformation
;
22
26
public
function
__construct
(
Transformation
$transformation
)
27
{
28
$this->transformation =
$transformation
;
29
}
30
34
public
function
transform
($from)
35
{
36
if
(
false
=== is_array($from)) {
37
throw
new
ConstraintViolationException
(
38
'The input value must be an array'
,
39
'must_be_array'
40
);
41
}
42
43
$result
= [];
44
foreach
($from as $value) {
45
$transformedValue = $this->transformation->transform($value);
46
$result
[] = $transformedValue;
47
}
48
49
return
$result
;
50
}
51
55
public
function
__invoke
($from)
56
{
57
return
$this->
transform
($from);
58
}
59
}
$result
$result
Definition:
CleanUpTest.php:463
ILIAS\Refinery\To\Transformation\ListTransformation\transform
transform($from)
Perform the transformation.Please use this for transformations. It's more performant than calling inv...
Definition:
ListTransformation.php:34
ILIAS\Refinery\To\Transformation\ListTransformation\__construct
__construct(Transformation $transformation)
Definition:
ListTransformation.php:26
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\ListTransformation\__invoke
__invoke($from)
Transformations should be callable.This MUST do the same as transform.
Definition:
ListTransformation.php:55
ILIAS\Refinery\To\Transformation\ListTransformation
Definition:
ListTransformation.php:15
ILIAS\Refinery\Transformation
A transformation is a function from one datatype to another.
Definition:
Transformation.php:17
ConstraintViolationException
ILIAS\Refinery\To\Transformation\ListTransformation\$transformation
$transformation
Definition:
ListTransformation.php:21
src
Refinery
To
Transformation
ListTransformation.php
Generated on Wed Sep 3 2025 20:01:29 for ILIAS by
1.8.13 (using
Doxyfile
)