TYPO3 CMS  TYPO3_7-6
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 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', '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

◆ 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 161 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
bool

Definition at line 127 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
bool

Definition at line 94 of file TypeHandlingUtility.php.

◆ isSimpleType()

static TYPO3\CMS\Extbase\Utility\TypeHandlingUtility::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 TYPO3\CMS\Extbase\Validation\ValidatorResolver\buildSubObjectValidator(), and TYPO3\CMS\Extbase\Reflection\ReflectionService\convertParameterReflectionToArray().

◆ isValidTypeForMultiValueComparison()

static TYPO3\CMS\Extbase\Utility\TypeHandlingUtility::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 TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getPlainValue().

◆ 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 72 of file TypeHandlingUtility.php.

Referenced by TYPO3\CMS\Extbase\Mvc\Controller\Argument\__construct(), TYPO3\CMS\Extbase\Scheduler\FieldProvider\getDefaultArgumentValue(), and TYPO3\CMS\Extbase\Scheduler\FieldProvider\renderField().

◆ 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\Reflection\ClassSchema\addProperty(), TYPO3\CMS\Extbase\Validation\ValidatorResolver\buildSubObjectValidator(), TYPO3\CMS\Extbase\Reflection\ReflectionService\convertParameterReflectionToArray(), and TYPO3\CMS\Extbase\Property\TypeConverter\ObjectStorageConverter\getTypeOfChildProperty().

Member Data Documentation

◆ $collectionTypes

TYPO3\CMS\Extbase\Utility\TypeHandlingUtility::$collectionTypes = ['array', 'ArrayObject', 'SplObjectStorage', \TYPO3\CMS\Extbase\Persistence\ObjectStorage::class]
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|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.