WpOrg\Requests

Requests::flatten()public staticWP 1.0

Convert a key => value array to a 'key: value' array for headers

Method of the class: Requests{}

No Hooks.

Return

Array. List of headers

Usage

$result = Requests::flatten( $dictionary );
$dictionary(iterable) (required)
Dictionary of header values

Requests::flatten() code WP 6.5.2

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;
}