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)
63 if (is_string($type)) {
71 if ($allow_null && $var === null) {
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);
117 if (array_keys($keys) !== $keys) {
118 $this->
error(
'Indices for list are not uniform');
176 $vtype = gettype($var);
191 if (!isset($lookup[$type])) {
194 return $lookup[$type];