ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ListTransformation.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26
28{
31
33
35 {
36 $this->transformation = $transformation;
37 }
38
42 public function transform($from): array
43 {
44 if (!is_array($from)) {
45 $from = [$from];
46 }
47
48 $result = [];
49 foreach ($from as $val) {
50 $transformedVal = $this->transformation->transform($val);
51 $result[] = $transformedVal;
52 }
53
54 return $result;
55 }
56}
A transformation is a function from one datatype to another.