3 declare(strict_types=1);
41 foreach ($transformations as $transformation) {
43 $transformationClassName = Transformation::class;
46 sprintf(
'The array must contain only "%s" instances', $transformationClassName),
47 'not_a_transformation',
48 $transformationClassName
60 if (!is_array($from)) {
66 sprintf(
'The array "%s" ist empty', var_export($from,
true)),
67 'value_array_is_empty',
75 foreach ($from as
$key => $value) {
76 if (!array_key_exists(
$key, $this->transformations)) {
78 sprintf(
'Matching key "%s" not found',
$key),
79 'matching_values_not_found',
83 $transformedValue = $this->transformations[
$key]->transform($value);
84 $result[] = $transformedValue;
92 $countOfValues = count($values);
93 $countOfTransformations = count($this->transformations);
95 if ($countOfValues !== $countOfTransformations) {
97 sprintf(
'The length of given value "%s" does not match with the given transformations', $countOfValues),
trait DeriveApplyToFromTransform
trait DeriveInvokeFromTransform
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...