WpOrg\Requests\Response

Headers::flatten()publicWP 1.0

Flattens a value into a string

Converts an array into a string by imploding values with a comma, as per RFC2616's rules for folding headers.

Method of the class: Headers{}

No Hooks.

Return

String. Flattened value

Usage

$Headers = new Headers();
$Headers->flatten( $value );
$value(string|array) (required)
Value to flatten

Headers::flatten() code WP 6.6.2

public function flatten($value) {
	if (is_string($value)) {
		return $value;
	}

	if (is_array($value)) {
		return implode(',', $value);
	}

	throw InvalidArgument::create(1, '$value', 'string|array', gettype($value));
}