NativeRequestHandler
in package
implements
RequestHandlerInterface
A request handler using PHP super globals $_GET, $_POST and $_SERVER.
Tags
Table of Contents
Interfaces
- RequestHandlerInterface
- Submits forms if they were submitted.
Constants
- FILE_KEYS = ['error', 'name', 'size', 'tmp_name', 'type']
- The allowed keys of the $_FILES array.
Properties
- $serverParams : mixed
Methods
- __construct() : mixed
- getUploadFileError() : int|null
- handleRequest() : mixed
- Submits a form if it was submitted.
- isFileUpload() : bool
- Returns true if the given data is a file upload.
- fixPhpFilesArray() : mixed
- Fixes a malformed PHP $_FILES array.
- getRequestMethod() : string
- stripEmptyFiles() : mixed
Constants
FILE_KEYS
The allowed keys of the $_FILES array.
private
mixed
FILE_KEYS
= ['error', 'name', 'size', 'tmp_name', 'type']
Properties
$serverParams
private
mixed
$serverParams
Methods
__construct()
public
__construct([ServerParams $params = null ]) : mixed
Parameters
- $params : ServerParams = null
getUploadFileError()
public
getUploadFileError(mixed $data) : int|null
Parameters
- $data : mixed
Return values
int|nullhandleRequest()
Submits a form if it was submitted.
public
handleRequest(FormInterface $form[, mixed $request = null ]) : mixed
Parameters
- $form : FormInterface
- $request : mixed = null
Tags
isFileUpload()
Returns true if the given data is a file upload.
public
isFileUpload(mixed $data) : bool
Parameters
- $data : mixed
Return values
boolfixPhpFilesArray()
Fixes a malformed PHP $_FILES array.
private
static fixPhpFilesArray(mixed $data) : mixed
PHP has a bug that the format of the $_FILES array differs, depending on whether the uploaded file fields had normal field names or array-like field names ("normal" vs. "parent[child]").
This method fixes the array to look like the "normal" $_FILES array.
It's safe to pass an already converted array, in which case this method just returns the original array unmodified.
This method is identical to and should be kept as such in order to port fixes quickly and easily.
Parameters
- $data : mixed
getRequestMethod()
private
static getRequestMethod() : string
Return values
stringstripEmptyFiles()
private
static stripEmptyFiles(mixed $data) : mixed
Parameters
- $data : mixed