ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
Series.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types=1);
3 
4 /* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
5 
10 namespace ILIAS\Refinery\In;
11 
16 
17 class 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
__construct(array $transformations)
Definition: Series.php:30
A transformation is a function from one datatype to another.
transform($from)
Perform the transformation.Please use this for transformations. It&#39;s more performant than calling inv...
Definition: Series.php:49