19        if ($allow_null && $var === 
null) {
 
   33                if (is_string($var) && ctype_digit($var)) {
 
   38                if ((is_string($var) && is_numeric($var)) || is_int($var)) {
 
   43                if (is_int($var) && ($var === 0 || $var === 1)) {
 
   45                } elseif (is_string($var)) {
 
   46                    if ($var == 
'on' || $var == 
'true' || $var == 
'1') {
 
   48                    } elseif ($var == 
'off' || $var == 
'false' || $var == 
'0') {
 
   58                if (is_string($var)) {
 
   65                    if (strpos($var, 
"\n") === 
false && strpos($var, 
"\r") === 
false) {
 
   68                        $var = explode(
',', $var);
 
   70                        $var = preg_split(
'/(,|[\n\r]+)/', $var);
 
   73                    foreach ($var as 
$i => $j) {
 
   76                    if (
$type === self::HASH) {
 
   79                        foreach ($var as $keypair) {
 
   80                            $c = explode(
':', $keypair, 2);
 
   84                            $nvar[trim(
$c[0])] = trim(
$c[1]);
 
   89                if (!is_array($var)) {
 
   92                $keys = array_keys($var);
 
   94                    if (
$type == self::ALIST) {
 
   96                    } elseif (
$type == self::LOOKUP) {
 
   98                        foreach ($var as 
$key) {
 
  106                if (
$type === self::ALIST) {
 
  107                    trigger_error(
"Array list did not have consecutive integer indexes", E_USER_WARNING);
 
  108                    return array_values($var);
 
  110                if (
$type === self::LOOKUP) {
 
  111                    foreach ($var as 
$key => $value) {
 
  112                        if ($value !== 
true) {
 
  114                                "Lookup array has non-true value at key '$key'; " .
 
  115                                "maybe your input array was not indexed numerically",
 
An exception for terminatinating execution or to throw for unit testing.
Exception type for HTMLPurifier_VarParser.
Performs safe variable parsing based on types which can be used by users.
parseImplementation($var, $type, $allow_null)
Parses string representations into their corresponding native PHP variable type.
errorInconsistent($class, $type)
Throws an inconsistency exception.
errorGeneric($var, $type)
Generic error for if a type didn't work.