ILIAS  release_7 Revision v7.30-3-g800a261c036
Series.php
Go to the documentation of this file.
1<?php
2declare(strict_types=1);
3
4/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
5
10namespace ILIAS\Refinery\In;
11
16
17class Series implements Transformation
18{
21
26
30 public function __construct(array $transformations)
31 {
32 foreach ($transformations as $transformation) {
33 if (!$transformation instanceof Transformation) {
34 $transformationClassName = Transformation::class;
35
37 sprintf('The array MUST contain only "%s" instances', $transformationClassName),
38 'not_a_transformation',
39 $transformationClassName
40 );
41 }
42 }
43 $this->transformationStrategies = $transformations;
44 }
45
49 public function transform($from)
50 {
51 $result = $from;
52 foreach ($this->transformationStrategies as $strategy) {
53 $result = $strategy->transform($result);
54 }
55
56 return $result;
57 }
58}
$result
An exception for terminatinating execution or to throw for unit testing.
__construct(array $transformations)
Definition: Series.php:30
transform($from)
Perform the transformation.Please use this for transformations. It's more performant than calling inv...
Definition: Series.php:49
A transformation is a function from one datatype to another.