Documentation

IntTransformer extends AbstractStringTransformer
in package
implements IFormTransformer

FinalYes

Table of Contents

Interfaces

IFormTransformer
Transforms the data submitted with a POST request from its PHP representation (parsedBody) to its representation in the app (formData).

Methods

__construct()  : mixed
extractTextInput()  : string|null
transformSubmittedData()  : mixed
Extract the submitted value for the given field and convert it to the app data format.

Methods

extractTextInput()

public extractTextInput(array<string|int, mixed> $parsedPayload) : string|null
Parameters
$parsedPayload : array<string|int, mixed>
Tags
throws
MissingInputException

If no input bears the specified name.

UnexpectedValueException

If the value associated with the input is not a string.

Return values
string|null

The submitted, non-empty string, or null if the string is empty.

transformSubmittedData()

Extract the submitted value for the given field and convert it to the app data format.

public transformSubmittedData(array<string|int, mixed> $parsedPayload, array<string|int, mixed> $uploadedFiles) : mixed

It is not always possible to decide whether a value evaluating to null or false was submitted or if no value was submitted because of a malformed or non-valid request for instance. For instance unchecked checkboxes submit the same value (actually, no submitted value at all, not even null), than if the field did not exist in the HTML form at all. A string left blank will evaluate to an empty string and not to null.

Parameters
$parsedPayload : array<string|int, mixed>
$uploadedFiles : array<string|int, mixed>
Attributes
#[Override]
Return values
mixed

The submitted value converted to the app data format, or null if the user submitted a value evaluating to null.

On this page

Search results