ILIAS  release_7 Revision v7.30-3-g800a261c036
Parallel.php
Go to the documentation of this file.
1<?php
2declare(strict_types=1);
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
9namespace ILIAS\Refinery\In;
10
15
16class Parallel implements Transformation
17{
20
25
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 $results = array();
52 foreach ($this->transformationStrategies as $strategy) {
53 $results[] = $strategy->transform($from);
54 }
55
56 return $results;
57 }
58}
An exception for terminatinating execution or to throw for unit testing.
__construct(array $transformations)
Definition: Parallel.php:30
transform($from)
Perform the transformation.Please use this for transformations. It's more performant than calling inv...
Definition: Parallel.php:49
A transformation is a function from one datatype to another.
$results