class CallbackTransformer implements DataTransformerInterface

Methods

__construct(callable $transform, callable $reverseTransform)

Constructor.

mixed
transform(mixed $data)

Transforms a value from the original representation to a transformed representation.

mixed
reverseTransform(mixed $data)

Transforms a value from the transformed representation to its original representation.

Details

at line line 39
__construct(callable $transform, callable $reverseTransform)

Constructor.

Parameters

callable $transform The forward transform callback
callable $reverseTransform The reverse transform callback

at line line 55
mixed transform(mixed $data)

Transforms a value from the original representation to a transformed representation.

Parameters

mixed $data The value in the original representation

Return Value

mixed The value in the transformed representation

Exceptions

UnexpectedTypeException when the argument is not of the expected type
TransformationFailedException when the transformation fails

at line line 71
mixed reverseTransform(mixed $data)

Transforms a value from the transformed representation to its original representation.

Parameters

mixed $data The value in the transformed representation

Return Value

mixed The value in the original representation

Exceptions

UnexpectedTypeException when the argument is not of the expected type
TransformationFailedException when the transformation fails