WpOrg\Requests

Requests::flatten()public staticWP 1.0

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

Метод класса: Requests{}

Хуков нет.

Возвращает

Массив. List of headers

Использование

$result = Requests::flatten( $dictionary );
$dictionary(iterable) (обязательный)
Dictionary of header values

Код Requests::flatten() WP 6.4.3

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