protected function encode($value)
    {
        if (is_array($value)) {
            return array_map([$this, 'encode'], $value);
        } else {
            return str_replace(['+', '%7E'], [' ', '~'], rawurlencode($value));
        }
    }
protected function encode($value)
    {
        if (is_array($value)) {
            return array_map([$this, 'encode'], $value);
        } else {
            return str_replace(['+', '%7E'], [' ', '~'], rawurlencode($value));
        }
    }
protected function encode ( $ value ) { if ( is_array ( $ value ) ) { return array_map ( [ $ this , 'encode' ] , $ value ) ; } else { return str_replace ( [ '+' , '%7E' ] , [ ' ' , '~' ] , rawurlencode ( $ value ) ) ; } }
Encode according to RFC 3986.

@param string|array $value Value to be normalized.

@return string
Encode according to RFC 3986 .