phpBB API Documentation
Class

phpbb\request\type_cast_helper

class type_cast_helper implements type_cast_helper_interface

A helper class that provides convenience methods for type casting.

Methods

__construct()

Initialises the type cast helper class.

addslashes_recursively($var)

Recursively applies addslashes to a variable.

add_magic_quotes($var)

Recursively applies addslashes to a variable if magic quotes are turned on.

set_var(mixed $result, mixed $var, mixed $type, bool $multibyte = false, bool $trim = true)

Set variable $result to a particular type.

recursive_set_var($var, $default, $multibyte, $trim = true)

Recursively sets a variable to a given type using {@link setvar setvar}

Details

at line 31
public __construct()

Initialises the type cast helper class.

All it does is find out whether magic quotes are turned on.

at line 48
public addslashes_recursively($var)

Recursively applies addslashes to a variable.

Parameters

$var

at line 76
public add_magic_quotes($var)

Recursively applies addslashes to a variable if magic quotes are turned on.

Parameters

$var

at line 95
public set_var(mixed $result, mixed $var, mixed $type, bool $multibyte = false, bool $trim = true)

Set variable $result to a particular type.

Parameters

mixed $result The variable to fill
mixed $var The contents to fill with
mixed $type The variable type. Will be used with {@link settype()}
bool $multibyte Indicates whether string values may contain UTF-8 characters. Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks.
bool $trim Indicates whether trim() should be applied to string values. Default is true.

at line 151
public recursive_set_var($var, $default, $multibyte, $trim = true)

Recursively sets a variable to a given type using {@link setvar setvar}

Parameters

$var
$default
$multibyte
$trim