ExpressionTypeCasterTrait
Offers a method to convert values to ExpressionInterface objects if the type they should be converted to implements ExpressionTypeInterface
Table of Contents
Methods
- _castToExpression() : mixed
- Conditionally converts the passed value to an ExpressionInterface object if the type class implements the ExpressionTypeInterface. Otherwise, returns the value unmodified.
- _requiresToExpressionCasting() : array<string|int, mixed>
- Returns an array with the types that require values to be casted to expressions, out of the list of type names passed as parameter.
Methods
_castToExpression()
Conditionally converts the passed value to an ExpressionInterface object if the type class implements the ExpressionTypeInterface. Otherwise, returns the value unmodified.
protected
_castToExpression(mixed $value[, string|null $type = null ]) : mixed
Parameters
- $value : mixed
-
The value to convert to ExpressionInterface
- $type : string|null = null
-
The type name
_requiresToExpressionCasting()
Returns an array with the types that require values to be casted to expressions, out of the list of type names passed as parameter.
protected
_requiresToExpressionCasting(array<string|int, mixed> $types) : array<string|int, mixed>
Parameters
- $types : array<string|int, mixed>
-
List of type names