3 declare(strict_types=1);
46 foreach ($transformations as $transformation) {
48 $transformationClassName = Transformation::class;
51 sprintf(
'The array MUST contain only "%s" instances', $transformationClassName),
52 'not_a_transformation',
53 $transformationClassName
69 foreach ($from as
$key => $value) {
70 $transformedValue = $this->transformations[
$key]->transform($value);
71 $result[] = $transformedValue;
106 return count(array_filter($value,
function (
$key):
bool {
107 if (!array_key_exists(
$key, $this->transformations)) {
108 $this->error = sprintf(
'There is no entry "%s" defined in the transformation array',
$key);
112 }, ARRAY_FILTER_USE_KEY)) === 0;
117 $countOfValues = count($values);
118 $countOfTransformations = count($this->transformations);
120 if ($countOfValues !== $countOfTransformations) {
121 $this->error = sprintf(
122 'The given values(count: "%s") does not match with the given transformations("%s")',
124 $countOfTransformations
A constraint encodes some resrtictions on values.
trait DeriveApplyToFromTransform
trait DeriveInvokeFromTransform
getErrorMessage($value)
Get the problem message.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...