WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

YoastSEO_Vendor\GuzzleHttp\Psr7

_parse_message() Yoast 1.0

Parses an HTTP message into an associative array.

The array contains the "start-line" key containing the start line of the message, "headers" key containing an associative array of header array values, and a "body" key containing the body of the message.

Хуков нет.

Возвращает

Массив.

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

_parse_message( $message );
$message(строка) (обязательный)
HTTP request or response to parse.

Код _parse_message() Yoast 15.6.2

<?php
function _parse_message($message)
{
    if (!$message) {
        throw new \InvalidArgumentException('Invalid message');
    }
    $message = \ltrim($message, "\r\n");
    $messageParts = \preg_split("/\r?\n\r?\n/", $message, 2);
    if ($messageParts === \false || \count($messageParts) !== 2) {
        throw new \InvalidArgumentException('Invalid message: Missing header delimiter');
    }
    list($rawHeaders, $body) = $messageParts;
    $rawHeaders .= "\r\n";
    // Put back the delimiter we split previously
    $headerParts = \preg_split("/\r?\n/", $rawHeaders, 2);
    if ($headerParts === \false || \count($headerParts) !== 2) {
        throw new \InvalidArgumentException('Invalid message: Missing status line');
    }
    list($startLine, $rawHeaders) = $headerParts;
    if (\preg_match("/(?:^HTTP\\/|^[A-Z]+ \\S+ HTTP\\/)(\\d+(?:\\.\\d+)?)/i", $startLine, $matches) && $matches[1] === '1.0') {
        // Header folding is deprecated for HTTP/1.1, but allowed in HTTP/1.0
        $rawHeaders = \preg_replace(\YoastSEO_Vendor\GuzzleHttp\Psr7\Rfc7230::HEADER_FOLD_REGEX, ' ', $rawHeaders);
    }
    /** @var array[] $headerLines */
    $count = \preg_match_all(\YoastSEO_Vendor\GuzzleHttp\Psr7\Rfc7230::HEADER_REGEX, $rawHeaders, $headerLines, \PREG_SET_ORDER);
    // If these aren't the same, then one line didn't match and there's an invalid header.
    if ($count !== \substr_count($rawHeaders, "\n")) {
        // Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4
        if (\preg_match(\YoastSEO_Vendor\GuzzleHttp\Psr7\Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) {
            throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding');
        }
        throw new \InvalidArgumentException('Invalid header syntax');
    }
    $headers = [];
    foreach ($headerLines as $headerLine) {
        $headers[$headerLine[1]][] = $headerLine[2];
    }
    return ['start-line' => $startLine, 'headers' => $headers, 'body' => $body];
}