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);

    }
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);

    }
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 ) ; }
Generic validator.

@param mixed $data Data to validate
@param string $type Type (one of self::$supported_types)
@param callable $filter Custom filter
@return bool
@throws UnexpectedValueException
Generic validator .