return is_float($d); }); DataModel::RegisterType("UnsignedFloat", function ($d) { return (double) $d; }, function ($d, $c) { return is_numeric($d) && is_float($c($d)) && $c($d) >= 0; }); DataModel::RegisterType("String", function ($d) { return (string) $d; }, function ($d, $c) { $d = $c($d); return is_string($d); }); DataModel::RegisterType("NotEmptyString", function ($d) { return (string) $d; }, function ($d, $c) { $d = $c($d); return is_string($d) && $d != ""; }); DataModel::RegisterType("Phone", function ($d) { return (string) $d; }, function ($d, $c) { $d = $c($d); return is_string($d) && strlen($d) == 10; }); DataModel::RegisterType("Email", function ($d) { return (string) $d; }, function ($d, $c) { $d = $c($d); return is_string($d) && filter_var($d, FILTER_VALIDATE_EMAIL); });