src/Kisma/Core/Utility/FilterInput.php
public static function get( $type, $key, $defaultValue = null, $filter = FILTER_DEFAULT, $filterOptions = null, $emptyValueIsNull = false )
    {
        //	Allow usage as filter_var()
        if ( is_array( $type ) )
        {
            $_result = filter_var( Option::get( $type, $key, $defaultValue ), $filter, $filterOptions );

            return $emptyValueIsNull && empty( $_result ) ? null : $_result;
        }

        $_haystack = null;

        //	Based on the type, pull the right value
        switch ( $type )
        {
            case INPUT_REQUEST:
                $_haystack = isset( $_REQUEST ) ? $_REQUEST : array();
                break;
            case INPUT_SESSION:
                $_haystack = isset( $_SESSION ) ? $_SESSION : array();
                break;
            case INPUT_GET:
                $_haystack = isset( $_GET ) ? $_GET : array();
                break;
            case INPUT_POST:
                $_haystack = isset( $_POST ) ? $_POST : array();
                break;
            case INPUT_COOKIE:
                $_haystack = isset( $_COOKIE ) ? $_COOKIE : array();
                break;
            case INPUT_SERVER:
                $_haystack = isset( $_SERVER ) ? $_SERVER : array();
                break;
            case INPUT_ENV:
                $_haystack = isset( $_ENV ) ? $_ENV : array();
                break;
            default:
                //	No clue what you want man...
                throw new \InvalidArgumentException( 'The filter type of "' . $type . '" is unknown or not supported.' );
        }

        $_value = empty( $_haystack ) ? $defaultValue : filter_var( Option::get( $_haystack, $key, $defaultValue ), $filter, $filterOptions );

        return $emptyValueIsNull && empty( $_value ) ? null : $_value;
    }
public static function get( $type, $key, $defaultValue = null, $filter = FILTER_DEFAULT, $filterOptions = null, $emptyValueIsNull = false )
    {
        //	Allow usage as filter_var()
        if ( is_array( $type ) )
        {
            $_result = filter_var( Option::get( $type, $key, $defaultValue ), $filter, $filterOptions );

            return $emptyValueIsNull && empty( $_result ) ? null : $_result;
        }

        $_haystack = null;

        //	Based on the type, pull the right value
        switch ( $type )
        {
            case INPUT_REQUEST:
                $_haystack = isset( $_REQUEST ) ? $_REQUEST : array();
                break;
            case INPUT_SESSION:
                $_haystack = isset( $_SESSION ) ? $_SESSION : array();
                break;
            case INPUT_GET:
                $_haystack = isset( $_GET ) ? $_GET : array();
                break;
            case INPUT_POST:
                $_haystack = isset( $_POST ) ? $_POST : array();
                break;
            case INPUT_COOKIE:
                $_haystack = isset( $_COOKIE ) ? $_COOKIE : array();
                break;
            case INPUT_SERVER:
                $_haystack = isset( $_SERVER ) ? $_SERVER : array();
                break;
            case INPUT_ENV:
                $_haystack = isset( $_ENV ) ? $_ENV : array();
                break;
            default:
                //	No clue what you want man...
                throw new \InvalidArgumentException( 'The filter type of "' . $type . '" is unknown or not supported.' );
        }

        $_value = empty( $_haystack ) ? $defaultValue : filter_var( Option::get( $_haystack, $key, $defaultValue ), $filter, $filterOptions );

        return $emptyValueIsNull && empty( $_value ) ? null : $_value;
    }
public static function get ( $ type , $ key , $ defaultValue = null , $ filter = FILTER_DEFAULT , $ filterOptions = null , $ emptyValueIsNull = false ) { //	Allow usage as filter_var() if ( is_array ( $ type ) ) { $ _result = filter_var ( Option :: get ( $ type , $ key , $ defaultValue ) , $ filter , $ filterOptions ) ; return $ emptyValueIsNull && empty ( $ _result ) ? null : $ _result ; } $ _haystack = null ; //	Based on the type, pull the right value switch ( $ type ) { case INPUT_REQUEST : $ _haystack = isset ( $ _REQUEST ) ? $ _REQUEST : array ( ) ; break ; case INPUT_SESSION : $ _haystack = isset ( $ _SESSION ) ? $ _SESSION : array ( ) ; break ; case INPUT_GET : $ _haystack = isset ( $ _GET ) ? $ _GET : array ( ) ; break ; case INPUT_POST : $ _haystack = isset ( $ _POST ) ? $ _POST : array ( ) ; break ; case INPUT_COOKIE : $ _haystack = isset ( $ _COOKIE ) ? $ _COOKIE : array ( ) ; break ; case INPUT_SERVER : $ _haystack = isset ( $ _SERVER ) ? $ _SERVER : array ( ) ; break ; case INPUT_ENV : $ _haystack = isset ( $ _ENV ) ? $ _ENV : array ( ) ; break ; default : //	No clue what you want man... throw new \ InvalidArgumentException ( 'The filter type of "' . $ type . '" is unknown or not supported.' ) ; } $ _value = empty ( $ _haystack ) ? $ defaultValue : filter_var ( Option :: get ( $ _haystack , $ key , $ defaultValue ) , $ filter , $ filterOptions ) ; return $ emptyValueIsNull && empty ( $ _value ) ? null : $ _value ; }
The master function, performs all filters and gets. Gets around lack of INPUT_SESSION and INPUT_REQUEST
support.

@param int|array      $type                         One of INPUT_GET, INPUT_POST, INPUT_COOKIE, INPUT_SERVER, INPUT_ENV,
INPUT_SESSION and INPUT_REQUEST. You may also pass in an array and use this
method to call filter_var with the value found in the array
@param string         $key                          The name of a variable to get.
@param mixed          $defaultValue                 The default value if the key is not found
@param int            $filter                       The filter to use (see the manual page). Defaults to FILTER_DEFAULT.
@param int|array|null $filterOptions                Associative array of options or bitwise disjunction of flags. If
filter accepts options,
flags can be provided in "flags" field of array. For the "callback" filter,
callback type should be passed. The callback must accept one argument,
the value to be filtered, and return the value after filtering/sanitizing it.
@param bool           $emptyValueIsNull             If true, empty() values will be returned as NULL

@throws \InvalidArgumentException
@return mixed
The master function performs all filters and gets . Gets around lack of INPUT_SESSION and INPUT_REQUEST support .