HTMLPurifier_VarParser_Flexible
Performs safe variable parsing based on types which can be used by users. This may not be able to represent all possible data inputs, however.
- Full name:
\HTMLPurifier_VarParser_Flexible
- Parent class:
\HTMLPurifier_VarParser
Methods
parseImplementation
Actually implements the parsing. Base implementation does not do anything to $var. Subclasses should overload this!
protected parseImplementation(mixed $var, int $type, bool $allow_null): array|bool|float|int|mixed|null|string
Parameters:
Parameter | Type | Description |
---|---|---|
$var |
mixed | |
$type |
int | |
$allow_null |
bool |
Throws:
Inherited methods
parse
Validate a variable according to type.
It may return NULL as a valid type if $allow_null is true.
- This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$var |
mixed | Variable to validate |
$type |
int | Type of variable, see HTMLPurifier_VarParser->types |
$allow_null |
bool | Whether or not to permit null as a value |
Return Value:
Validated and type-coerced variable
Throws:
parseImplementation
Actually implements the parsing. Base implementation does not do anything to $var. Subclasses should overload this!
Parameters:
Parameter | Type | Description |
---|---|---|
$var |
mixed | |
$type |
int | |
$allow_null |
bool |
error
Throws an exception.
Parameters:
Parameter | Type | Description |
---|---|---|
$msg |
mixed |
Throws:
errorInconsistent
Throws an inconsistency exception.
Parameters:
Parameter | Type | Description |
---|---|---|
$class |
string | |
$type |
int |
Throws:
errorGeneric
Generic error for if a type didn't work.
Parameters:
Parameter | Type | Description |
---|---|---|
$var |
mixed | |
$type |
int |
getTypeName
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$type |
int |
Automatically generated on 2025-03-18