Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Utils.php

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

Utils

Namespace

GuzzleHttp

Code

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;
}
RSS feed
Powered by Drupal