src/Kisma/Core/Utility/FilterInput.php
public static function smart( $value, $emptyValueIsNull = false )
    {
        if ( is_array( $value ) )
        {
            filter_var_array( $value, FILTER_SANITIZE_STRING );
        }

        switch ( getType( $value ) )
        {
            case 'double':
            case 'float':
                $_filter = FILTER_SANITIZE_NUMBER_FLOAT;
                break;

            case 'integer':
                $_filter = FILTER_SANITIZE_NUMBER_INT;
                break;

            case 'string':
                $_filter = FILTER_SANITIZE_STRING;
                break;

            default:
                $_filter = FILTER_DEFAULT;
                break;
        }

        $_result = filter_var( $value, $_filter );

        return $emptyValueIsNull && empty( $_result ) ? null : $_result;
    }
public static function smart( $value, $emptyValueIsNull = false )
    {
        if ( is_array( $value ) )
        {
            filter_var_array( $value, FILTER_SANITIZE_STRING );
        }

        switch ( getType( $value ) )
        {
            case 'double':
            case 'float':
                $_filter = FILTER_SANITIZE_NUMBER_FLOAT;
                break;

            case 'integer':
                $_filter = FILTER_SANITIZE_NUMBER_INT;
                break;

            case 'string':
                $_filter = FILTER_SANITIZE_STRING;
                break;

            default:
                $_filter = FILTER_DEFAULT;
                break;
        }

        $_result = filter_var( $value, $_filter );

        return $emptyValueIsNull && empty( $_result ) ? null : $_result;
    }
public static function smart ( $ value , $ emptyValueIsNull = false ) { if ( is_array ( $ value ) ) { filter_var_array ( $ value , FILTER_SANITIZE_STRING ) ; } switch ( getType ( $ value ) ) { case 'double' : case 'float' : $ _filter = FILTER_SANITIZE_NUMBER_FLOAT ; break ; case 'integer' : $ _filter = FILTER_SANITIZE_NUMBER_INT ; break ; case 'string' : $ _filter = FILTER_SANITIZE_STRING ; break ; default : $ _filter = FILTER_DEFAULT ; break ; } $ _result = filter_var ( $ value , $ _filter ) ; return $ emptyValueIsNull && empty ( $ _result ) ? null : $ _result ; }
Filter chooser based on number or string. Not very smart really.

@param mixed $value
@param bool  $emptyValueIsNull If true, empty() values will be returned as NULL

@return mixed
Filter chooser based on number or string . Not very smart really .