\HTMLPurifier_VarParser
Parses string representations into their corresponding native PHP variable type. The base implementation does a simple type-check.
Synopsis
class HTMLPurifier_VarParser
{
- // constants
- const STRING = 1;
- const ISTRING = 2;
- const TEXT = 3;
- const ITEXT = 4;
- const INT = 5;
- const FLOAT = 6;
- const BOOL = 7;
- const LOOKUP = 8;
- const ALIST = 9;
- const HASH = 10;
- const MIXED = 11;
- // members
- public static array $types = ;
- public static array $stringTypes = ;
- // methods
- public final Validated parse()
- protected void parseImplementation()
- protected void error()
- protected void errorInconsistent()
- protected void errorGeneric()
- public static void getTypeName()
Constants
Name | Value |
---|---|
STRING | 1 |
ISTRING | 2 |
TEXT | 3 |
ITEXT | 4 |
INT | 5 |
FLOAT | 6 |
BOOL | 7 |
LOOKUP | 8 |
ALIST | 9 |
HASH | 10 |
MIXED | 11 |
Members
public
-
$stringTypes
Lookup table of types that are string, and can have aliases or allowed value lists. -
$types
Lookup table of allowed types. Mainly for backwards compatibility, but also convenient for transforming string type names to the integer constants.
Methods
protected
- error() — Throws an exception.
- errorGeneric() — Generic error for if a type didn't work.
- errorInconsistent() — Throws an inconsistency exception.
- parseImplementation() — Actually implements the parsing. Base implementation is to not do anything to $var. Subclasses should overload this!
public
- getTypeName()
- parse() — Validate a variable according to type. Throws HTMLPurifier_VarParserException if invalid.