function Utils::headersFromLines
Parses an array of header lines into an associative array of headers.
Parameters
iterable $lines Header lines array of strings in the following: format: "Name: Value"
2 calls to Utils::headersFromLines()
- HeaderProcessor::parseHeaders in vendor/
guzzlehttp/ guzzle/ src/ Handler/ HeaderProcessor.php - Returns the HTTP version, status code, reason phrase, and headers.
- headers_from_lines in vendor/
guzzlehttp/ guzzle/ src/ functions.php - Parses an array of header lines into an associative array of headers.
File
-
vendor/
guzzlehttp/ guzzle/ src/ Utils.php, line 46
Class
Namespace
GuzzleHttpCode
public static function headersFromLines(iterable $lines) : array {
$headers = [];
foreach ($lines as $line) {
$parts = \explode(':', $line, 2);
$headers[\trim($parts[0])][] = isset($parts[1]) ? \trim($parts[1]) : null;
}
return $headers;
}