2 declare(strict_types=1);
24 foreach ($transformations as $transformation) {
26 $transformationClassName = Transformation::class;
29 sprintf(
'The array must contain only "%s" instances', $transformationClassName),
30 'not_a_transformation',
31 $transformationClassName
43 if (!is_array($from)) {
49 sprintf(
'The array "%s" ist empty', $from),
50 'value_array_is_empty',
58 foreach ($from as $key => $value) {
59 if (!array_key_exists($key, $this->transformations)) {
61 sprintf(
'Matching value "%s" not found', $value),
62 'matching_values_not_found',
66 $transformedValue = $this->transformations[$key]->transform($value);
74 $countOfValues = count($values);
75 $countOfTransformations = count($this->transformations);
77 if ($countOfValues !== $countOfTransformations) {
79 sprintf(
'The length of given value "%s" does not match with the given transformations', $countOfValues),
trait DeriveApplyToFromTransform
trait DeriveInvokeFromTransform