Convert a key => value array to a ‘key: value’ array for headers
Parameters
$dictionary
WpOrgRequestsiterablerequired- Dictionary of header values
Source
public static function flatten($dictionary) {
if (InputValidator::is_iterable($dictionary) === false) {
throw InvalidArgument::create(1, '$dictionary', 'iterable', gettype($dictionary));
}
$return = [];
foreach ($dictionary as $key => $value) {
$return[] = sprintf('%s: %s', $key, $value);
}
return $return;
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.