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