TYPO3  7.6
Static Public Member Functions | Public Attributes | Static Protected Attributes | List of all members
TypeHandlingUtility Class Reference

Static Public Member Functions

static parseType ($type)
 
static normalizeType ($type)
 
static isLiteral ($type)
 
static isSimpleType ($type)
 
static isCoreType ($type)
 
static isCollectionType ($type)
 
static isValidTypeForMultiValueComparison ($value)
 
static hex2bin ($hexadecimalData)
 

Public Attributes

const PARSE_TYPE_PATTERN = '/^\\\\?(?P<type>integer|int|float|double|boolean|bool|string|DateTime|Tx_[a-zA-Z0-9_]+|[A-Z][a-zA-Z0-9\\\\_]+|object|resource|array|ArrayObject|SplObjectStorage|TYPO3\\\\CMS\\\\Extbase\\\\Persistence\\\\ObjectStorage)(?:<\\\\?(?P<elementType>[a-zA-Z0-9\\\\_]+)>)?/'
 
const LITERAL_TYPE_PATTERN = '/^(?:integer|int|float|double|boolean|bool|string)$/'
 

Static Protected Attributes

static $collectionTypes = array('array', 'ArrayObject', 'SplObjectStorage', \TYPO3\CMS\Extbase\Persistence\ObjectStorage::class)
 

Detailed Description

PHP type handling functions

Definition at line 18 of file TypeHandlingUtility.php.

Member Function Documentation

static hex2bin (   $hexadecimalData)
static

Converts a hex encoded string into binary data

Parameters
string$hexadecimalDataA hex encoded string of data
Returns
string A binary string decoded from the input

Definition at line 161 of file TypeHandlingUtility.php.

static isCollectionType (   $type)
static

Returns TRUE if the $type is a collection type.

Parameters
string$type
Returns
bool

Definition at line 127 of file TypeHandlingUtility.php.

Referenced by CollectionValidator\validate().

static isCoreType (   $type)
static

Returns TRUE if the $type is a CMS core type object.

Parameters
string | object$type
Returns
bool

Definition at line 116 of file TypeHandlingUtility.php.

Referenced by CoreTypeConverter\canConvertFrom(), DataMapper\getPlainValue(), and DataMapper\thawProperties().

static isLiteral (   $type)
static

Returns TRUE if the $type is a literal.

Parameters
string$type
Returns
bool

Definition at line 94 of file TypeHandlingUtility.php.

static isSimpleType (   $type)
static

Returns TRUE if the $type is a simple type.

Parameters
string$type
Returns
bool

Definition at line 105 of file TypeHandlingUtility.php.

Referenced by ReflectionService\convertParameterReflectionToArray().

static isValidTypeForMultiValueComparison (   $value)
static

Returns TRUE when the given value can be used in an "in" comparison in a query.

Parameters
mixed$value
Returns
bool

Definition at line 150 of file TypeHandlingUtility.php.

Referenced by DataMapper\getPlainValue().

static normalizeType (   $type)
static

Normalize data types so they match the PHP type names: int -> integer double -> float bool -> boolean

Parameters
string$typeData type to unify
Returns
string unified data type

Definition at line 72 of file TypeHandlingUtility.php.

Referenced by Argument\__construct().

static parseType (   $type)
static

Returns an array with type information, including element type for collection types (array, SplObjectStorage, ...)

Parameters
string$typeType of the property (see PARSE_TYPE_PATTERN)
Returns
array An array with information about the type
Exceptions
\TYPO3\CMS\Extbase\Utility\Exception\InvalidTypeException

Definition at line 43 of file TypeHandlingUtility.php.

Referenced by ClassSchema\addProperty(), and ReflectionService\convertParameterReflectionToArray().

Member Data Documentation

$collectionTypes = array('array', 'ArrayObject', 'SplObjectStorage', \TYPO3\CMS\Extbase\Persistence\ObjectStorage::class)
staticprotected

Definition at line 33 of file TypeHandlingUtility.php.

const LITERAL_TYPE_PATTERN = '/^(?:integer|int|float|double|boolean|bool|string)$/'

A type pattern to detect literal types.

Definition at line 28 of file TypeHandlingUtility.php.

const PARSE_TYPE_PATTERN = '/^\\\\?(?P<type>integer|int|float|double|boolean|bool|string|DateTime|Tx_[a-zA-Z0-9_]+|[A-Z][a-zA-Z0-9\\\\_]+|object|resource|array|ArrayObject|SplObjectStorage|TYPO3\\\\CMS\\\\Extbase\\\\Persistence\\\\ObjectStorage)(?:<\\\\?(?P<elementType>[a-zA-Z0-9\\\\_]+)>)?/'

A property type parse pattern.

Definition at line 23 of file TypeHandlingUtility.php.