Parses content part headers.
@param string $headerContent headers source content
@return array parsed headers.
184572
private function parseHeaders($headerContent)
    {
        $headers = [];
        $headerParts = preg_split('/\\R/s', $headerContent, -1, PREG_SPLIT_NO_EMPTY);
        foreach ($headerParts as $headerPart) {
            if (strpos($headerPart, ':') === false) {
                continue;
            }

            [$headerName, $headerValue] = explode(':', $headerPart, 2);
            $headerName = strtolower(trim($headerName));
            $headerValue = trim($headerValue);

            if (strpos($headerValue, ';') === false) {
                $headers[$headerName] = $headerValue;
            } else {
                $headers[$headerName] = [];
                foreach (explode(';', $headerValue) as $part) {
                    $part = trim($part);
                    if (strpos($part, '=') === false) {
                        $headers[$headerName][] = $part;
                    } else {
                        [$name, $value] = explode('=', $part, 2);
                        $name = strtolower(trim($name));
                        $value = trim(trim($value), '"');
                        $headers[$headerName][$name] = $value;
                    }
                }
            }
        }

        return $headers;
    }
29662
private function parseHeader(string $header)
    {
        if (strpos($header, 'Basic') !== 0) {
            return false;
        }

        $header = base64_decode(substr($header, 6));

        if ($header === false) {
            return false;
        }

        $header = explode(':', $header, 2);

        return [
            'username' => $header[0],
            'password' => isset($header[1]) ? $header[1] : null,
        ];
    }
757430
public static function getBoxHTML($boxContent)
    {
        $html = '';
        if (empty($boxContent))
            return NULL;

        $html .= '<!-- Start_Box -->';

        $html .= '<div class="box box-info">';
        $html .= self::getBoxHeaderHTML($boxContent["header"]);
        $html .= '<div class="box-body">';
        $html .= self::getTableHTML($boxContent["table"]);
        $html .= '</div>';
        $html .= self::getBoxFooterHTML($boxContent["footer"]);
        $html .= '</div>';

        $html .= '<!-- End_Box -->';

        return $html;
    }
143401
public static function parseHeader(string $header): array
    {
        $cookie = [];
        $kvs = explode('; ', $header);
        $nv = explode('=', array_shift($kvs));
        $cookie['name'] = $nv[0];
        //because of some stupid system could return Set-Cookie: foo=''; so we must replace it.
        $cookie['value'] = str_replace(['\'\'', '""'], '', $nv[1]);
        foreach ($kvs as $kv) {
            $kv = explode('=', $kv);
            $kv[0] = strtolower($kv[0]);
            if (isset($kv[1])) {
                $cookie[$kv[0]] = $kv[1];
            } else {
                $cookie[$kv[0]] = true;
            }
        }
        /**
         * If a response includes both an Expires header and a max-age directive,
         * the max-age directive overrides the Expires header!
         */
        if (isset($cookie['max-age'])) {
            $cookie['expires'] = time() + $cookie['max-age'];
        } else {
            if (isset($cookie['expires'])) {
                $cookie['expires'] = strtotime($cookie['expires']);
            }
        }

        return $cookie;
    }
96709
private static function headers_to_array($headerContent) {
		$headers = array();
		$arrRequests = explode("\r\n\r\n", $headerContent);
		foreach (explode("\r\n", $arrRequests[0]) as $i => $line) {
			if ($i === 0) {
				$headers['http_code'] = $line;
			} else {
				list($key, $value) = explode(': ', $line);
				$headers[$key] = $value;
			}
		}
		return $headers;
	}
157026
public static function parseHeaders(string $headers): array
    {
        $res = [];

        foreach (explode("\r\n", $headers) as $line) {
            $line = trim($line);
            if (!$line) {
                continue;
            }

            $line = explode(': ', $line);
            if (count($line) !== 2) {
                continue;
            }

            $res[strtolower($line[0])] = $line[1];
        }

        return $res;
    }
916505
private function getDeserializedContent($jsonContent)
    {
        $serializer = $this->getSerializer();

        $data = trim($jsonContent);
        if (substr($data, 0, 1) === '[') { // Check if the current content is an array
            $deserializationType = 'array<'.SerializableInterface::class.'>';
            $array = $serializer->deserialize($data, $deserializationType, 'json');
            $content = new SerializableArray($array);
        } else {
            $content = $serializer->deserialize($data, SerializableInterface::class, 'json');
        }

        return $content;
    }
692563
protected function _parseResponseHeaders($headers)
    {
        $headers = str_replace("\r", "", $headers);
        $headers = explode("\n", $headers);
        $parsed  = array();

        foreach($headers as $header)
        {
            $field_end = strpos($header, ':');

            if($field_end === FALSE)
            {
                /* Cover the case where we're at the first header, the HTTP
                 *  status header
                 */
                $field = 'status';
                $value = $header;
            }
            else
            {
                $field = substr($header, 0, $field_end);
                $value = substr($header, $field_end + 1);
            }

            $parsed[$field] = $value;
        }

        return $parsed;
    }
314315
private function parseContent($content = '')
    {

        list($time, $content) = explode("#", $content);
        return [
            $time, gzuncompress($content)
        ];

    }
1144888
public static function parseHeaders(array $headers)
    {
        $headerGroups = array();
        $headerList = array();

        // Collect matching headers into groups
        foreach ($headers as $line) {
            list($key, $value) = explode(': ', $line, 2);
            if (!isset($headerGroups[$key])) {
                $headerGroups[$key] = array();
            }
            $headerGroups[$key][] = $value;
        }
        
        // Collapse groups
        foreach ($headerGroups as $key => $values) {
            $headerList[$key] = implode(', ', $values);
        }

        return $headerList;
    }
978137
private function parseHeaders(array $headers)
    {
        $indexes = [];
        $metas   = [];

        foreach ($headers as $key => $value) {
            $key = strtolower($key);

            if (strpos($key, 'x-riak-index-') === 0) {
                $name  = substr($key, 13);
                $value = isset($indexes[$name])
                    ? array_merge($indexes[$name], $value)
                    : $value;

                $indexes[$name] = $value;
            }

            if (strpos($key, 'x-riak-meta-') === 0) {
                $name  = strtolower(substr($key, 12));
                $value = is_array($value)
                    ? reset($value)
                    : $value;

                $metas[$name] = $value;
            }
        }

        return [
            'indexes' => $indexes,
            'metas'   => $metas
        ];
    }
245463
private function parseHeaders(array $headers)
    {

        // Set the raw headers as we got from the constructor.
        $this->raw_headers = $headers;

        // flatten the headers array so that values are not arrays themselves
        // but rather simple key value pairs.
        $headers = array_map(function ($value) {

            if (! is_array($value))
                return $value;

            return implode(';', $value);
        }, $headers);

        // Set the parsed headers.
        $this->headers = $headers;

        // Check for some header values that might be interesting
        // such as the current error limit and number of pages
        // available.
        $this->hasHeader('X-Esi-Error-Limit-Remain') ?
            $this->error_limit = (int) $this->getHeader('X-Esi-Error-Limit-Remain') : null;

        $this->hasHeader('X-Pages') ? $this->pages = (int) $this->getHeader('X-Pages') : null;
    }
594856
function formatUsageHeader(headerContent) {
  var headerString =  headerContent instanceof Array ?
    headerContent.join(EOL) :
    headerContent;

  return headerString + EOL;
}
1131279
protected function extractResponse($zipContent)
    {
        if (!$this->cdrReader) {
            $this->cdrReader = new DomCdrReader(new XmlReader());
        }

        $xml = $this->getXmlResponse($zipContent);

        return $this->cdrReader->getCdrResponse($xml);
    }
597773
public static function parse($headers)
    {
        if (is_string($headers)) {
            $headers = explode("\r\n\r\n", trim($headers));

            return explode("\r\n", end($headers));
        }

        $parsedHeaders = [];

        foreach ($headers as $name => $value) {
            $value = HeadersNormalizer::normalizeHeaderValue($value);

            if (is_int($name)) {
                if (strpos($value, 'HTTP/') === 0) {
                    $parsedHeaders = [$value];
                } else {
                    $parsedHeaders[] = $value;
                }
            } else {
                $parsedHeaders[] = $name.': '.$value;
            }
        }

        return $parsedHeaders;
    }
697918
public function parseJwtHeaderContent($jwtHeaderString)
    {

        $tokenJsonHeader = json_decode($jwtHeaderString, true);

        $alg = $tokenJsonHeader['alg'];
        $kid = $tokenJsonHeader['kid'];

        return new JwtHeaderContent($alg, $kid);
    }
887348
protected function parseContentRange()
    {
        $contentRange = $this->request->header('content-range');
        if (empty($contentRange) === false) {
            return sscanf($contentRange, 'bytes %d-%d/%d');
        }

        $total = $end = (int) $this->request->header('content-length');

        return [0, $end, $total];
    }