TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Extbase\Utility\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 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|array|ArrayObject|SplObjectStorage|TYPO3\\\\CMS\\\\Extbase\\\\Persistence\\\\ObjectStorage|Tx_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', 'Tx_Extbase_Persistence_ObjectStorage')
 

Detailed Description

PHP type handling functions

Definition at line 18 of file TypeHandlingUtility.php.

Member Function Documentation

◆ hex2bin()

static TYPO3\CMS\Extbase\Utility\TypeHandlingUtility::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 144 of file TypeHandlingUtility.php.

◆ isCollectionType()

static TYPO3\CMS\Extbase\Utility\TypeHandlingUtility::isCollectionType (   $type)
static

Returns TRUE if the $type is a collection type.

Parameters
string$type
Returns
boolean

Definition at line 122 of file TypeHandlingUtility.php.

Referenced by TYPO3\CMS\Extbase\Validation\ValidatorResolver\buildSubObjectValidator(), and TYPO3\CMS\Extbase\Validation\Validator\CollectionValidator\validate().

◆ isCoreType()

static TYPO3\CMS\Extbase\Utility\TypeHandlingUtility::isCoreType (   $type)
static

◆ isLiteral()

static TYPO3\CMS\Extbase\Utility\TypeHandlingUtility::isLiteral (   $type)
static

Returns TRUE if the $type is a literal.

Parameters
string$type
Returns
boolean

Definition at line 92 of file TypeHandlingUtility.php.

Referenced by TYPO3\CMS\Extbase\Service\TypeHandlingService\isLiteral().

◆ isSimpleType()

static TYPO3\CMS\Extbase\Utility\TypeHandlingUtility::isSimpleType (   $type)
static

Returns TRUE if the $type is a simple type.

Parameters
string$type
Returns
boolean

Definition at line 102 of file TypeHandlingUtility.php.

Referenced by TYPO3\CMS\Extbase\Validation\ValidatorResolver\buildSubObjectValidator(), and TYPO3\CMS\Extbase\Service\TypeHandlingService\isSimpleType().

◆ normalizeType()

static TYPO3\CMS\Extbase\Utility\TypeHandlingUtility::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 71 of file TypeHandlingUtility.php.

Referenced by TYPO3\CMS\Extbase\Service\TypeHandlingService\normalizeType().

◆ parseType()

static TYPO3\CMS\Extbase\Utility\TypeHandlingUtility::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

Definition at line 43 of file TypeHandlingUtility.php.

Referenced by TYPO3\CMS\Extbase\Validation\ValidatorResolver\buildSubObjectValidator(), TYPO3\CMS\Extbase\Property\TypeConverter\ObjectStorageConverter\getTypeOfChildProperty(), and TYPO3\CMS\Extbase\Service\TypeHandlingService\parseType().

Member Data Documentation

◆ $collectionTypes

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

Definition at line 33 of file TypeHandlingUtility.php.

◆ LITERAL_TYPE_PATTERN

const TYPO3\CMS\Extbase\Utility\TypeHandlingUtility::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.

◆ PARSE_TYPE_PATTERN

const TYPO3\CMS\Extbase\Utility\TypeHandlingUtility::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|array|ArrayObject|SplObjectStorage|TYPO3\\\\CMS\\\\Extbase\\\\Persistence\\\\ObjectStorage|Tx_Extbase_Persistence_ObjectStorage)(?:<\\\\?(?P<elementType>[a-zA-Z0-9\\\\_]+)>)?/'

A property type parse pattern.

Definition at line 23 of file TypeHandlingUtility.php.