Documentation

Request
in package

Should be used for getting request data for processing pages.

For display pages, see Smr\Session::getRequestVar.

Table of Contents

Methods

get()  : string
Returns index value as a (trimmed) string.
getArray()  : array<int, string>
Returns index value as an array of strings with integer keys.
getBool()  : bool
Returns index value as a boolean for boolean-like inputs.
getFloat()  : float
Returns index value as a float.
getInt()  : int
Returns index value as an integer.
getIntArray()  : array<int, int>
Returns index value as an array of integers with integer keys.
getUploadedTmpName()  : string
getUploadError()  : int
getVar()  : string
Returns index value as a string from either $_REQUEST or Session.
getVarInt()  : int
Like getVar, but returns an int instead of a string.
getVarIntArray()  : array<int, int>
Like getVar, but returns an array of ints instead of a string.
has()  : bool
Returns true if index is set.
getUploadedFile()  : array<string|int, mixed>
getVarX()  : T
Helper function to avoid code duplication in getVar* functions.
getX()  : T

Methods

get()

Returns index value as a (trimmed) string.

public static get(string $index[, string|null $default = null ]) : string
Parameters
$index : string
$default : string|null = null
Return values
string

getArray()

Returns index value as an array of strings with integer keys.

public static getArray(string $index[, array<int, string>|null $default = null ]) : array<int, string>
Parameters
$index : string
$default : array<int, string>|null = null
Return values
array<int, string>

getBool()

Returns index value as a boolean for boolean-like inputs.

public static getBool(string $index[, bool|null $default = null ]) : bool

Whitespace is treated as missing: it returns the default or raises the same exception as an absent value, unlike has().

Parameters
$index : string
$default : bool|null = null
Return values
bool

getFloat()

Returns index value as a float.

public static getFloat(string $index[, float|null $default = null ]) : float

Whitespace is treated as missing: it returns the default or raises the same exception as an absent value, unlike has().

Parameters
$index : string
$default : float|null = null
Return values
float

getInt()

Returns index value as an integer.

public static getInt(string $index[, int|null $default = null ]) : int

Whitespace is treated as missing: it returns the default or raises the same exception as an absent value, unlike has().

Parameters
$index : string
$default : int|null = null
Return values
int

getIntArray()

Returns index value as an array of integers with integer keys.

public static getIntArray(string $index[, array<int, int>|null $default = null ]) : array<int, int>
Parameters
$index : string
$default : array<int, int>|null = null
Return values
array<int, int>

getUploadedTmpName()

public static getUploadedTmpName(string $index) : string
Parameters
$index : string
Return values
string

getUploadError()

public static getUploadError(string $index) : int
Parameters
$index : string
Return values
int

getVar()

Returns index value as a string from either $_REQUEST or Session.

public static getVar(string $index[, string|null $default = null ]) : string

This is useful for processing pages that need to handle data both from posted form inputs and from saved Session variables.

Note that this does not save the result in Session data.

Parameters
$index : string
$default : string|null = null
Return values
string

getVarInt()

Like getVar, but returns an int instead of a string.

public static getVarInt(string $index[, int|null $default = null ]) : int
Parameters
$index : string
$default : int|null = null
Return values
int

getVarIntArray()

Like getVar, but returns an array of ints instead of a string.

public static getVarIntArray(string $index[, array<int, int>|null $default = null ]) : array<int, int>
Parameters
$index : string
$default : array<int, int>|null = null
Return values
array<int, int>

has()

Returns true if index is set.

public static has(string $index) : bool

Note that this must be used for checkboxes, since the element is not posted if a box is unchecked.

Parameters
$index : string
Return values
bool

getUploadedFile()

private static getUploadedFile(string $index) : array<string|int, mixed>
Parameters
$index : string
Return values
array<string|int, mixed>

getVarX()

Helper function to avoid code duplication in getVar* functions.

private static getVarX(string $index, T|null $default, callable(string, Array): T $func, Type<string|int, T> $type) : T
Parameters
$index : string
$default : T|null
$func : callable(string, Array): T
$type : Type<string|int, T>
Tags
template
Return values
T

getX()

private static getX(string $index, T|null $default, callable(string): Array $filter) : T
Parameters
$index : string
$default : T|null
$filter : callable(string): Array
Tags
template
Return values
T

        
On this page

Search results