public static function validate($data, $type, callable $filter=null) {

        $type = strtoupper($type);

        if ( !array_key_exists($type, self::$supported_types) ) {
            throw new UnexpectedValueException("Bad validation type");
        }

        return call_user_func(self::$supported_types[$type], $data, $filter);

    }