@param string $header

@return array
494305
private function aggregatedValues(string $header): array
    {
        $values = [];
        foreach (explode(',', $header) as $headerValue) {
            $headerValueParts = explode(';', $headerValue);
            $mediaType = trim(array_shift($headerValueParts));
            $attributes = [];
            foreach ($headerValueParts as $attribute) {
                list($attributeKey, $attributeValue) = explode('=', $attribute);
                $attributes[trim($attributeKey)] = trim($attributeValue);
            }

            if (!isset($attributes['q'])) {
                $attributes['q'] = '1.0';
            }

            $values[$mediaType] = $attributes;
        }

        uasort($values, function (array $a, array $b) {
            return $b['q'] <=> $a['q'];
        });

        return $values;
    }
1134470
private function parseFieldsFromHeaderAndItemAsArray(
        array $header,
        array $item
    ) {
        return [
            'metadata' => $this->parseSectionFromHeaderAndItemAsArray($header, 'metadata', $item),
            'indexed_metadata' => $this->parseSectionFromHeaderAndItemAsArray($header, 'indexed_metadata', $item),
            'searchable_metadata' => $this->parseSectionFromHeaderAndItemAsArray($header, 'searchable_metadata', $item),
        ];
    }
1075431
protected function normalizeHeaders(array $headers) : array
    {
        $returnHeaders = [];
        foreach ($headers as $key => $header) {
            $returnHeaders[$key] = $header[0] ?? $header;
        }

        return $returnHeaders;
    }
486117
public function setHeader($header) {
        if (is_array($header)) {
            foreach ($header as $v) {
                $this->setHeader($v);
            }
        } else {
            // Remove newlines, they are not allowed in headers.
            $newvalue = preg_replace('/[\r\n]/', '', $header);
            if (!in_array($newvalue, $this->header)) {
                $this->header[] = $newvalue;
            }
        }
    }
723087
protected function _extractHttpCode($header) {
		preg_match(
			'#^HTTP/[0-9\.]+\s(?P<code>[0-9]+)#i',
			$header,
			$matches
		);

		return isset($matches['code'])
			? $matches['code']
			: $this->_defaultCode;
	}
1060466
public static function normalizeHeaderName($header)
    {
        $filtered = str_replace('-', ' ', $header);
        $filtered = ucwords($filtered);

        return str_replace(' ', '-', $filtered);
    }
201140
private function getHeaderIp(string $header)
    {
        foreach (array_reverse(array_map('trim', explode(',', $header))) as $ip) {
            if (self::isValid($ip) && !$this->isInProxiedIps($ip)) {
                return $ip;
            }
        }
    }
288211
private function parseHeader($header)
    {
        $res = preg_match_all('/(?:[^,"]*+(?:"[^"]*+")?)+[^,"]*+/', $header, $matches);

        if (!$res) {
            throw new InvalidHeader(sprintf('Failed to parse accept header: "%s"', $header));
        }

        return array_values(array_filter(array_map('trim', $matches[0])));
    }
728636
protected function dispatchHttpStatus($header)
    {
         $statuses = array();
         $result = preg_match('/^http\/[1|2]\.\d (\d{3}) (.*)$/i', $header, $statuses);

         if ($result < 1) {
             $this->throwException();
         }

         // Code, status text
         return array((int)$statuses[1], $statuses[2]);
    }
1219015
function getHeaderValue($header){
		$header = strtolower($header);
		$headers = $this->getResponseHeaders(array("as_hash" => true, "lowerize_keys" => true));
		if(isset($headers["$header"])){ return $headers["$header"]; }
	}
607787
public static function parse($header)
    {
        if (strpos($header, '=') === false) {
            $header = '='.$header;
        }

        list($name, $header) = explode('=', $header, 2);

        if (strpos($header, ';') === false) {
            $value = $header;
            $header = null;
        } else {
            list($value, $header) = explode(';', $header, 2);
        }

        $attributes = [];
        foreach (array_map('trim', explode(';', $header)) as $pair) {
            if (empty($pair)) {
                continue;
            }

            if (strpos($pair, '=') === false) {
                $attributeName = $pair;
                $attributeValue = null;
            } else {
                list($attributeName, $attributeValue) = explode('=', $pair);
            }

            $attributes[trim($attributeName)] = $attributeValue ? trim($attributeValue) : true;
        }

        $name = trim($name);
        $value = trim($value);

        return [!empty($name) ? $name : null, !empty($value) ? $value : null, $attributes];
    }
64073
public function getHeader($header)
    {
        return isset($this->headers[$header]) ? $this->headers[$header] : null;
    }
595609
public function splitHttpAcceptHeader($header)
    {
        $values = [];
        foreach (array_filter(explode(',', $header)) as $value) {
            // Cut off any q-value that might come after a semi-colon
            if ($pos = strpos($value, ';')) {
                $q = (float) trim(substr($value, strpos($value, '=') + 1));
                $value = substr($value, 0, $pos);
            } else {
                $q = 1;
            }

            if (0 < $q) {
                $values[trim($value)] = $q;
            }
        }

        arsort($values);

        return array_keys($values);
    }
1271531
public function getHeaderLine(string $header): ?string
    {
        $headers = $this->header->get($header);

        return $headers === [] ? null : \implode(', ', $headers);
    }
321994
protected function dispatchHeaderValue($header)
    {
        $header = explode(':', $header, 2);

        if (count($header) < 2) {
            return null;
        }

        return array(
            'name' => trim($header[0]),
            'value' => trim($header[1]),
        );
    }
999883
public function get(string $header)
  {
    return isset($this->all[$header]) ? $this->all[$header] : null;
  }
818563
public function parseHeader($header)
    {
        $parsed_header = array();

        $header_lines = explode("\r\n", $header);
        if (count($header_lines) > 0) {
            foreach ($header_lines as $line) {
                $header = explode(':', $line);
                if (count($header) > 1) {
                    $label = array_shift($header);

                    $value = $header;
                    $value = implode(':', $header);
                    $value = trim($value);

                    $parsed_header[$label] = $value;
                }
            }
        }

        return $parsed_header;
    }