‪TYPO3CMS  9.5
TYPO3\CMS\Extbase\Utility\TypeHandlingUtility Class Reference

Static Public Member Functions

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

Public Attributes

const PARSE_TYPE_PATTERN = '/^\\\\?(?P<type>integer|int|float|double|boolean|bool|string|DateTimeImmutable|DateTime|[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 array $collectionTypes = array( 'array', 'ArrayObject', 'SplObjectStorage', \TYPO3\CMS\Extbase\Persistence\ObjectStorage::class )
 

Detailed Description

PHP type handling functions

only to be used within Extbase, not part of TYPO3 Core API.

Definition at line 18 of file TypeHandlingUtility.php.

Member Function Documentation

◆ hex2bin()

static string TYPO3\CMS\Extbase\Utility\TypeHandlingUtility::hex2bin (   $hexadecimalData)
static

Converts a hex encoded string into binary data

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

Definition at line 159 of file TypeHandlingUtility.php.

◆ isCollectionType()

static bool 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 125 of file TypeHandlingUtility.php.

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

◆ isCoreType()

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

◆ isLiteral()

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

Returns TRUE if the $type is a literal.

Parameters
string$type
Returns
‪bool

Definition at line 92 of file TypeHandlingUtility.php.

◆ isSimpleType()

static bool 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 103 of file TypeHandlingUtility.php.

Referenced by TYPO3\CMS\Extbase\Validation\ValidatorResolver\buildBaseValidatorConjunction(), and TYPO3\CMS\Extbase\Reflection\ClassSchema\reflectMethods().

◆ isValidTypeForMultiValueComparison()

static bool 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 148 of file TypeHandlingUtility.php.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getPlainValue().

◆ normalizeType()

static string 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$type‪Data type to unify
Returns
‪string unified data type

Definition at line 70 of file TypeHandlingUtility.php.

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

◆ parseType()

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

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

Parameters
string$type‪Type of the property (see PARSE_TYPE_PATTERN)
Returns
‪array An array with information about the type
Exceptions

Definition at line 42 of file TypeHandlingUtility.php.

References TYPO3\CMS\Extbase\Utility\TypeHandlingUtility\normalizeType().

Referenced by TYPO3\CMS\Extbase\Reflection\ClassSchema\addProperty(), TYPO3\CMS\Extbase\Property\TypeConverter\ObjectStorageConverter\getTypeOfChildProperty(), TYPO3\CMS\Extbase\Reflection\ClassSchema\reflectMethods(), and TYPO3\CMS\Extbase\Reflection\ClassSchema\reflectProperties().

Member Data Documentation

◆ $collectionTypes

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

Definition at line 32 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|DateTimeImmutable|DateTime|[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.