ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Series.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Refinery\In;
22
27
28class Series implements Transformation
29{
32
35
39 public function __construct(array $transformations)
40 {
41 foreach ($transformations as $transformation) {
42 if (!$transformation instanceof Transformation) {
43 $transformationClassName = Transformation::class;
44
46 sprintf('The array MUST contain only "%s" instances', $transformationClassName),
47 'not_a_transformation',
48 $transformationClassName
49 );
50 }
51 }
52 $this->transformationStrategies = $transformations;
53 }
54
58 public function transform($from)
59 {
60 $result = $from;
61 foreach ($this->transformationStrategies as $strategy) {
62 $result = $strategy->transform($result);
63 }
64
65 return $result;
66 }
67}
array $transformationStrategies
Definition: Series.php:34
__construct(array $transformations)
Definition: Series.php:39
transform($from)
@inheritDoc
Definition: Series.php:58
A transformation is a function from one datatype to another.