WC_REST_Authentication::join_with_equals_sign()privateWC 1.0

Creates an array of urlencoded strings out of each array key/value pairs.

Method of the class: WC_REST_Authentication{}

No Hooks.

Return

String. Array of urlencoded strings.

Usage

// private - for code of main (parent) class only
$result = $this->join_with_equals_sign( $params, $query_params, $key );
$params(array) (required)
Array of parameters to convert.
$query_params(array)
Array to extend.
Default: array()
$key(string)
Optional Array key to append.
Default: ''

WC_REST_Authentication::join_with_equals_sign() code WC 8.7.0

private function join_with_equals_sign( $params, $query_params = array(), $key = '' ) {
	foreach ( $params as $param_key => $param_value ) {
		if ( $key ) {
			$param_key = $key . '%5B' . $param_key . '%5D'; // Handle multi-dimensional array.
		}

		if ( is_array( $param_value ) ) {
			$query_params = $this->join_with_equals_sign( $param_value, $query_params, $param_key );
		} else {
			$string         = $param_key . '=' . $param_value; // Join with equals sign.
			$query_params[] = wc_rest_urlencode_rfc3986( $string );
		}
	}

	return $query_params;
}