Split a header string in name and value

@param string $header
@return array [name, value, key]
555729
protected function splitHeader($header)
    {
        list($name, $value) = explode(':', $header, 2);
        
        return [trim($name), trim($value), strtolower(trim($name))];
    }
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;
            }
        }
    }
640523
public function getHeader($name)
    {
        $headerSet = $this->getSwiftMessage()->getHeaders();
        if (!$headerSet->has($name)) {
            return [];
        }

        $headers = [];
        foreach ($headerSet->getAll($name) as $header) {
            $headers[] = $header->getValue();
        }
        return $headers;
    }
14808
public static function extractPluralsForms($header)
    {
        $headers = explode("\n", $header);
        $expr = 'nplurals=2; plural=n == 1 ? 0 : 1;';
        foreach ($headers as $header) {
            if (stripos($header, 'Plural-Forms:') === 0) {
                $expr = substr($header, 13);
            }
        }

        return $expr;
    }
368205
public function removeHeader($header)
    {
        $name = strtolower($header);
        unset($this->headers[$name]);

        foreach($this->headerLines as $key => $value)
            if(strtolower($key) == $name)
                unset($this->headerLines[$key]);

        return $this;
    }
129430
public final function getHeader($name): array
   {
       $key = $this->parseHeaderName($name);
       return array_key_exists($key, $this->header) ? $this->header[$key] : [];
   }
374591
private static function parseAuthorizationHeader($header)
    {
        if (strpos($header, 'Basic') !== 0) {
            return false;
        }

        $header = explode(':', base64_decode(substr($header, 6)), 2);

        return [
            'username' => $header[0],
            'password' => isset($header[1]) ? $header[1] : null,
        ];
    }
1239836
public function getHeaderAsArray(string $name) : array
    {
        $name = strtolower($name);

        return isset($this->headers[$name]) ? $this->headers[$name] : [];
    }
210317
public static function split_header($header, $only_allow_oauth_parameters = true) {
    $pattern = '/(([-_a-z]*)=("([^"]*)"|([^,]*)),?)/';
    $offset = 0;
    $params = array();
    while (preg_match($pattern, $header, $matches, PREG_OFFSET_CAPTURE, $offset) > 0) {
      $match = $matches[0];
      $header_name = $matches[2][0];
      $header_content = (isset($matches[5])) ? $matches[5][0] : $matches[4][0];
      if (preg_match('/^oauth_/', $header_name) || !$only_allow_oauth_parameters) {
        $params[$header_name] = OAuthUtil::urldecode_rfc3986($header_content);
      }
      $offset = $match[1] + strlen($match[0]);
    }

    if (isset($params['realm'])) {
      unset($params['realm']);
    }

    return $params;
  }
1219015
function getHeaderValue($header){
		$header = strtolower($header);
		$headers = $this->getResponseHeaders(array("as_hash" => true, "lowerize_keys" => true));
		if(isset($headers["$header"])){ return $headers["$header"]; }
	}
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;
    }
663894
private function parseContentRange($header)
    {
        if (preg_match('/(?P<unit>[\w]+)\s+(?P<first>\d+)-(?P<last>\d+)\/(?P<length>\d+|\*)/', $header, $matches)) {
            return [
                $matches['unit'],
                (int) $matches['first'],
                (int) $matches['last'],
                $matches['length'] === '*' ? '*' : (int) $matches['length'],
            ];
        }
        return false;
    }
702155
protected function splitNamespaceAndKey($key)
    {
        if (strpos($key, '::') !== false) {
            list($namespace, $key) = explode('::', $key, 2);

            return [$namespace, $key];
        }

        return ['', $key];
    }
75788
public function getHeader($header)
    {
        return isset($this->getHeaders()[$header]) ? $this->getHeaders()[$header] : null;
    }
1271531
public function getHeaderLine(string $header): ?string
    {
        $headers = $this->header->get($header);

        return $headers === [] ? null : \implode(', ', $headers);
    }
1107778
private function normalizeHeaders($headers)
    {
        $normalized = [];
        foreach ($headers as $name => $value) {
            $name              = $this->normalizeName($name);
            $normalized[$name] = $this->normalizeData($name, $value);
        }

        return $normalized;
    }
1209558
function values($name)
    {
        $normalizer = new HeaderCaseNormalizer();
        $name = $normalizer->normalize($name);
        $values = array();

        foreach ($this->_headers as $header) {
            if ($header->getName() == $name) {
                $values[] = $header->getValue();
            }
        }

        return $values;
    }