27        'string' => self::C_STRING,
 
   28        'istring' => self::ISTRING,
 
   30        'itext' => self::ITEXT,
 
   32        'float' => self::C_FLOAT,
 
   33        'bool' => self::C_BOOL,
 
   34        'lookup' => self::LOOKUP,
 
   35        'list' => self::ALIST,
 
   37        'mixed' => self::C_MIXED
 
   45        self::C_STRING => 
true,
 
   46        self::ISTRING => 
true,
 
   61    final public function parse($var, 
$type, $allow_null = 
false)
 
   63        if (is_string(
$type)) {
 
   71        if ($allow_null && $var === 
null) {
 
   77            case (self::C_STRING):
 
   81                if (!is_string($var)) {
 
   84                if (
$type == self::ISTRING || 
$type == self::ITEXT) {
 
   85                    $var = strtolower($var);
 
   94                if (!is_float($var)) {
 
  106                if (!is_array($var)) {
 
  109                if (
$type === self::LOOKUP) {
 
  110                    foreach ($var as $k) {
 
  112                            $this->
error(
'Lookup table contains value other than true');
 
  115                } elseif (
$type === self::ALIST) {
 
  116                    $keys = array_keys($var);
 
  118                        $this->
error(
'Indices for list are not uniform');
 
  122            case (self::C_MIXED):
 
  176        $vtype = gettype($var);
 
  191        if (!isset($lookup[
$type])) {
 
  194        return $lookup[
$type];
 
An exception for terminatinating execution or to throw for unit testing.
Global exception class for HTML Purifier; any exceptions we throw are from here.
Exception type for HTMLPurifier_VarParser.
Parses string representations into their corresponding native PHP variable type.
parseImplementation($var, $type, $allow_null)
Actually implements the parsing.
static $stringTypes
Lookup table of types that are string, and can have aliases or allowed value lists.
errorInconsistent($class, $type)
Throws an inconsistency exception.
static getTypeName($type)
errorGeneric($var, $type)
Generic error for if a type didn't work.
static $types
Lookup table of allowed types.
parse($var, $type, $allow_null=false)
Validate a variable according to type.
error($msg)
Throws an exception.