protected function buildQuery(string $name, $value, string $postfix= ''): string
    {
        $query = '';
        if (is_array($value)) {
            foreach ($value as $k => $v) {
                if (is_int($k)) {
                    $query .= $this->buildQuery('', $v, $postfix . $name .'[]');
                } else {
                    $query .= $this->buildQuery('', $v, $postfix . $name . '[' . $k . ']');
                }
            }
        } elseif (null === $value) {
            $query .= '&' . urlencode($name) . $postfix;
        } elseif (false === $value) {
            $query .= '&' . urlencode($name) . $postfix . '=0';
        } elseif (true === $value) {
            $query .= '&' . urlencode($name) . $postfix . '=1';
        } else {
            $query .= '&' . urlencode($name) . $postfix . '=' . urlencode($value);
        }

        return $query;
    }
protected function buildQuery(string $name, $value, string $postfix= ''): string
    {
        $query = '';
        if (is_array($value)) {
            foreach ($value as $k => $v) {
                if (is_int($k)) {
                    $query .= $this->buildQuery('', $v, $postfix . $name .'[]');
                } else {
                    $query .= $this->buildQuery('', $v, $postfix . $name . '[' . $k . ']');
                }
            }
        } elseif (null === $value) {
            $query .= '&' . urlencode($name) . $postfix;
        } elseif (false === $value) {
            $query .= '&' . urlencode($name) . $postfix . '=0';
        } elseif (true === $value) {
            $query .= '&' . urlencode($name) . $postfix . '=1';
        } else {
            $query .= '&' . urlencode($name) . $postfix . '=' . urlencode($value);
        }

        return $query;
    }
protected function buildQuery ( string $ name , $ value , string $ postfix = '' ) : string { $ query = '' ; if ( is_array ( $ value ) ) { foreach ( $ value as $ k => $ v ) { if ( is_int ( $ k ) ) { $ query .= $ this -> buildQuery ( '' , $ v , $ postfix . $ name . '[]' ) ; } else { $ query .= $ this -> buildQuery ( '' , $ v , $ postfix . $ name . '[' . $ k . ']' ) ; } } } elseif ( null === $ value ) { $ query .= '&' . urlencode ( $ name ) . $ postfix ; } elseif ( false === $ value ) { $ query .= '&' . urlencode ( $ name ) . $ postfix . '=0' ; } elseif ( true === $ value ) { $ query .= '&' . urlencode ( $ name ) . $ postfix . '=1' ; } else { $ query .= '&' . urlencode ( $ name ) . $ postfix . '=' . urlencode ( $ value ) ; } return $ query ; }
Calculates query string

@param   string  $name
@param   mixed   $value
@param   string  $postfix  The postfix to use for each variable (defaults to '')
@return  string
Calculates query string