RequestDataTransformerInterface
RequestDataTransformer Interface.
Perform a series of transformations on a set of data fields, as specified by a RequestSchemaInterface.
Tags
Table of Contents
setSchema() | Set the schema for this transformer, as a valid RequestSchemaInterface object. | mixed |
---|---|---|
transform() | Process each field in the specified data array, applying transformations in the specified order. | array |
transformField() | Transform a raw field value. | string |
Methods
setSchema()
Set the schema for this transformer, as a valid RequestSchemaInterface object.
public
setSchema(
$schema :
RequestSchemaInterface
)
: mixed
Parameters
- $schema : RequestSchemaInterface
A RequestSchemaInterface object, containing the transformation rules.
Return values
mixedtransform()
Process each field in the specified data array, applying transformations in the specified order.
public
transform(
$data :
array
, $onUnexpectedVar :
mixed
)
: array
Example transformations: escape/purge/purify HTML entities Also, set any default values for unspecified fields.
Parameters
- $data : array
The array of data to be transformed.
- $onUnexpectedVar : mixed
Return values
array —The array of transformed data, mapping field names => values.
transformField()
Transform a raw field value.
public
transformField(
$name :
string
, $value :
string
)
: string
Parameters
- $name : string
The name of the field to transform, as specified in the schema.
- $value : string
The value to be transformed.
Return values
string —The transformed value.