WpOrg\Requests
Requests::flatten()
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() Requests::flatten code WP 6.7.1
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; }