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.
$valuestring|arrayrequired
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));
}
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wporg-requests-response-headers/flatten