27         'string'    => self::STRING,
 
   28         'istring'   => self::ISTRING,
 
   30         'itext'     => self::ITEXT,
 
   32         'float'     => self::FLOAT,
 
   34         'lookup'    => self::LOOKUP,
 
   35         'list'      => self::ALIST,
 
   37         'mixed'     => self::MIXED
 
   46         self::ISTRING   => 
true,
 
   61     final public function parse($var, $type, $allow_null = 
false) {
 
   62         if (is_string($type)) {
 
   70         if ($allow_null && $var === null) 
return null;
 
   78                 if (!is_string($var)) 
break;
 
   79                 if ($type == self::ISTRING || $type == self::ITEXT) $var = strtolower($var);
 
   82                 if (!is_int($var)) 
break;
 
   85                 if (!is_float($var)) 
break;
 
   88                 if (!is_bool($var)) 
break;
 
   93                 if (!is_array($var)) 
break;
 
   94                 if ($type === self::LOOKUP) {
 
   95                     foreach ($var as $k) 
if ($k !== 
true) $this->
error(
'Lookup table contains value other than true');
 
   96                 } elseif ($type === self::ALIST) {
 
   97                     $keys = array_keys($var);
 
   98                     if (array_keys($keys) !== $keys) $this->
error(
'Indices for list are not uniform');
 
  138         $vtype = gettype($var);
 
  148         if (!isset($lookup[$type])) 
return 'unknown';
 
  149         return $lookup[$type];