public function query($key, $value = null)
    {
        $query = array();

        parse_str(
            $this->server()->get('QUERY_STRING'),
            $query
        );

        if (is_array($key)) {
            $query = array_merge($query, $key);
        } else {
            $query[$key] = $value;
        }

        $request_uri = $this->uri();

        if (strpos($request_uri, '?') !== false) {
            $request_uri = strstr($request_uri, '?', true);
        }

        return $request_uri . (!empty($query) ? '?' . http_build_query($query) : null);
    }
public function query($key, $value = null)
    {
        $query = array();

        parse_str(
            $this->server()->get('QUERY_STRING'),
            $query
        );

        if (is_array($key)) {
            $query = array_merge($query, $key);
        } else {
            $query[$key] = $value;
        }

        $request_uri = $this->uri();

        if (strpos($request_uri, '?') !== false) {
            $request_uri = strstr($request_uri, '?', true);
        }

        return $request_uri . (!empty($query) ? '?' . http_build_query($query) : null);
    }
public function query ( $ key , $ value = null ) { $ query = array ( ) ; parse_str ( $ this -> server ( ) -> get ( 'QUERY_STRING' ) , $ query ) ; if ( is_array ( $ key ) ) { $ query = array_merge ( $ query , $ key ) ; } else { $ query [ $ key ] = $ value ; } $ request_uri = $ this -> uri ( ) ; if ( strpos ( $ request_uri , '?' ) !== false ) { $ request_uri = strstr ( $ request_uri , '?' , true ) ; } return $ request_uri . ( ! empty ( $ query ) ? '?' . http_build_query ( $ query ) : null ) ; }
Adds to or modifies the current query string

@param string $key   The name of the query param
@param mixed $value  The value of the query param
@return string
Adds to or modifies the current query string