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

Static Public Member Functions

static array parseType (string $type)
 
static string normalizeType (string $type)
 
static bool isLiteral (string $type)
 
static bool isSimpleType (string $type)
 
static bool isCoreType ($type)
 
static bool isCollectionType (string $type)
 
static bool isValidTypeForMultiValueComparison ($value)
 
static string hex2bin (string $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::class, \SplObjectStorage::class, ObjectStorage::class )
 

Detailed Description

PHP type handling functions

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

Definition at line 28 of file TypeHandlingUtility.php.

Member Function Documentation

◆ hex2bin()

static string TYPO3\CMS\Extbase\Utility\TypeHandlingUtility::hex2bin ( string  $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
Deprecated:

Definition at line 170 of file TypeHandlingUtility.php.

◆ isCollectionType()

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

Returns TRUE if the $type is a collection type.

Parameters
string$type
Returns
‪bool

Definition at line 135 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 ( string  $type)
static

Returns TRUE if the $type is a literal.

Parameters
string$type
Returns
‪bool

Definition at line 102 of file TypeHandlingUtility.php.

◆ isSimpleType()

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

Returns TRUE if the $type is a simple type.

Parameters
string$type
Returns
‪bool

Definition at line 113 of file TypeHandlingUtility.php.

Referenced by TYPO3\CMS\Extbase\Validation\ValidatorResolver\buildBaseValidatorConjunction().

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

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getPlainValue(), and TYPO3\CMS\Extbase\Persistence\Generic\Query\in().

◆ normalizeType()

static string TYPO3\CMS\Extbase\Utility\TypeHandlingUtility::normalizeType ( string  $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 80 of file TypeHandlingUtility.php.

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

◆ parseType()

static array TYPO3\CMS\Extbase\Utility\TypeHandlingUtility::parseType ( string  $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 52 of file TypeHandlingUtility.php.

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

Referenced by TYPO3\CMS\Extbase\Property\TypeConverter\ObjectStorageConverter\getTypeOfChildProperty().

Member Data Documentation

◆ $collectionTypes

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

Definition at line 42 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 38 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 33 of file TypeHandlingUtility.php.