DataType
: string
in package
implements
ProvidesArrayOfValues
DataType
Interfaces, Classes, Traits and Enums
Table of Contents
- ARRAY = 'array'
- BOOL = 'bool'
- BOOLEAN = 'boolean'
- COLLECTION = 'collection'
- DATE = 'date'
- DATETIME = 'datetime'
- DOUBLE = 'double'
- FLOAT = 'float'
- INT = 'int'
- INTEGER = 'integer'
- JSON = 'json'
- OBJECT = 'object'
- REAL = 'real'
- STRING = 'string'
- TIMESTAMP = 'timestamp'
- aliases() : array<string|int, DataType>
- The data type's aliases.
- aliasMap() : array<string|int, array<string|int, DataType>>
- Map of data types and their aliases.
- areAllOfPrimitiveType() : bool
- Are all given data types the same primitive type?
- areAllOfType() : bool
- Are all given data types the same type?
- classMap() : array<class-string, array<string|int, DataType>>
- Map of classes to their data types.
- convertValueToString() : string
- Convert the inbound value to its string representation.
- fromValue() : static
- New instance from the type of variable passed.
- integerIsValidTimestamp() : bool
- Is a given integer a valid timestamp?
- is() : bool
- Checks if the given type is the same as this one.
- isIn() : bool
- Check if this data type is any of the given ones.
- isPrimitive() : bool
- Is this type a primitive type?
- primitiveMap() : array<string, array<string|int, DataType>>
- Map of data types to their primitive counterparts.
- primitives() : array<string|int, DataType>
- PHP primitive data types.
- resolveObjectClass() : string|null
- Resolve the class from the data type.
- stringIsValidJson() : bool
- Is a given string valid JSON?
- toPrimitive() : static|null
- Convert this data type to its primitive version.
- valueIsType() : bool
- Is the given value the same type as this instance?
- values() : array<string|int, mixed>
Cases
ARRAY
BOOL
BOOLEAN
COLLECTION
DATE
DATETIME
DOUBLE
FLOAT
INT
INTEGER
JSON
OBJECT
REAL
STRING
TIMESTAMP
Methods
aliases()
The data type's aliases.
public
aliases() : array<string|int, DataType>
Return values
array<string|int, DataType> —aliasMap()
Map of data types and their aliases.
public
static aliasMap() : array<string|int, array<string|int, DataType>>
Return values
array<string|int, array<string|int, DataType>> —areAllOfPrimitiveType()
Are all given data types the same primitive type?
public
static areAllOfPrimitiveType(DataType $primitiveDataType, array<string|int, DataType> $typesToCheck) : bool
Parameters
Tags
Return values
bool —areAllOfType()
Are all given data types the same type?
public
static areAllOfType(DataType $dataType, array<string|int, DataType> $typesToCheck) : bool
Parameters
Return values
bool —classMap()
Map of classes to their data types.
public
static classMap() : array<class-string, array<string|int, DataType>>
Return values
array<class-string, array<string|int, DataType>> —convertValueToString()
Convert the inbound value to its string representation.
public
convertValueToString(mixed $value) : string
Parameters
- $value : mixed
Return values
string —fromValue()
New instance from the type of variable passed.
public
static fromValue(mixed $value) : static
Parameters
- $value : mixed
Return values
static —integerIsValidTimestamp()
Is a given integer a valid timestamp?
public
static integerIsValidTimestamp(mixed $value) : bool
Parameters
- $value : mixed
Return values
bool —is()
Checks if the given type is the same as this one.
public
is(DataType|string|null $type) : bool
Parameters
- $type : DataType|string|null
Return values
bool —isIn()
Check if this data type is any of the given ones.
public
isIn(array<string|int, DataType>|array<string|int, string> $types) : bool
Parameters
- $types : array<string|int, DataType>|array<string|int, string>
Return values
bool —isPrimitive()
Is this type a primitive type?
public
isPrimitive() : bool
Return values
bool —primitiveMap()
Map of data types to their primitive counterparts.
public
static primitiveMap() : array<string, array<string|int, DataType>>
Return values
array<string, array<string|int, DataType>> —primitives()
PHP primitive data types.
public
static primitives() : array<string|int, DataType>
Return values
array<string|int, DataType> —resolveObjectClass()
Resolve the class from the data type.
public
resolveObjectClass() : string|null
Return values
string|null —stringIsValidJson()
Is a given string valid JSON?
public
static stringIsValidJson(mixed $value) : bool
Parameters
- $value : mixed
Return values
bool —toPrimitive()
Convert this data type to its primitive version.
public
toPrimitive() : static|null
Return values
static|null —valueIsType()
Is the given value the same type as this instance?
public
valueIsType(mixed $value) : bool
Parameters
- $value : mixed
Return values
bool —values()
public
static values() : array<string|int, mixed>