class CRM_Utils_Type

Constants

T_INT

T_STRING

T_ENUM

T_DATE

T_TIME

T_BOOLEAN

T_TEXT

T_LONGTEXT

T_BLOB

T_TIMESTAMP

T_FLOAT

T_MONEY

T_EMAIL

T_URL

T_CCNUM

T_MEDIUMBLOB

TWO

FOUR

SIX

EIGHT

TWELVE

SIXTEEN

TWENTY

MEDIUM

THIRTY

BIG

FORTYFIVE

HUGE

Methods

static string
typeToString(int $type)

Gets the string representation for a data type.

static string
getDataTypeFromFieldMetadata(array $fieldMetadata)

Get the data_type for the field.

static 
escapeAll($data, $type, $abort = TRUE)

Helper function to call escape on arrays.

static 
validateAll($data, $type, $abort = TRUE)

Helper function to call validate on arrays

static mixed
escape(mixed $data, string $type, bool $abort = TRUE)

Verify that a variable is of a given type, and apply a bit of processing.

static mixed
validate($data, $type, $abort = TRUE, $name = 'One of parameters ')

Verify that a variable is of a given type.

static string
mysqlOrderByFieldFunctionCallback(string $clause)

Preg_replace_callback for mysqlOrderByFieldFunction escape.

static 
mysqlOrderByCallback($matches)

preg_replace_callback for MysqlOrderBy escape.

static array
dataTypes()

Get list of avaliable Data Tupes for Option Groups

Details

at line 79
static string typeToString(int $type)

Gets the string representation for a data type.

Parameters

int $type Integer number identifying the data type.

Return Value

string String identifying the data type, e.g. 'Int' or 'String'.

at line 154
static string getDataTypeFromFieldMetadata(array $fieldMetadata)

Get the data_type for the field.

Parameters

array $fieldMetadata Metadata about the field.

Return Value

string

at line 173
static escapeAll($data, $type, $abort = TRUE)

Helper function to call escape on arrays.

Parameters

$data
$type
$abort

See also

escape

at line 185
static validateAll($data, $type, $abort = TRUE)

Helper function to call validate on arrays

Parameters

$data
$type
$abort

See also

validate

at line 205
static mixed escape(mixed $data, string $type, bool $abort = TRUE)

Verify that a variable is of a given type, and apply a bit of processing.

Parameters

mixed $data The value to be verified/escaped.
string $type The type to verify against.
bool $abort If TRUE, the operation will CRM_Core_Error::fatal() on invalid data.

Return Value

mixed The data, escaped if necessary.

at line 378
static mixed validate($data, $type, $abort = TRUE, $name = 'One of parameters ')

Verify that a variable is of a given type.

Parameters

$data
$type
$abort
$name

Return Value

mixed The data, escaped if necessary

at line 491
static string mysqlOrderByFieldFunctionCallback(string $clause)

Preg_replace_callback for mysqlOrderByFieldFunction escape.

Add backticks around the field name.

Parameters

string $clause

Return Value

string

at line 498
static mysqlOrderByCallback($matches)

preg_replace_callback for MysqlOrderBy escape.

Parameters

$matches

at line 525
static array dataTypes()

Get list of avaliable Data Tupes for Option Groups

Return Value

array