Returns request header value

@param string $name The header name
@param bool $first Return the first element or the whole header values
@return string|array When $first is true, returns string, otherwise, returns array
164685
public function getResponseHeader($name = null, $first = true)
    {
        // Return response header string when parameter is not provided
        if (is_null($name)) {
            return $this->responseHeader;
        }

        $name = strtoupper($name);
        $headers = $this->getResponseHeaders();

        if (!isset($headers[$name])) {
            return $first ? null : array();
        } else {
            return $first ? current($headers[$name]) : $headers[$name];
        }
    }
203053
public function header($name = null, $default = null) {
        if (null === $name) {
            return $this->getHeader();
        }
        $key = 'HTTP_' . str_replace('-', '_', strtoupper($name));
        return $_SERVER[$key] ?? $default;
    }
547880
public function getFirstTag($name)
    {
        foreach ($this->tags as $i => $tag) {
            if (strtolower($tag->getName()) == $name) {
                return $this->tags[$i];
            }
        }

        return null;
    }
362215
public function getHeaderValue($name)
    {
        $pattern = '#' . $name . ': (.*)#i';
        if (preg_match($pattern, $this->getResponseHeader(), $match)) {
            return $match[1];
        } else {
            return null;
        }
    }
346088
public function getHeader($name)
    {
        $internalName = strtolower($name);

        if (true === $this->hasHeader($internalName)) {
            $value = $this->headers[$internalName];

        } else {
            $value = null;
        }

        return $value;
    }
305284
protected function header(string $name)
    {
        return isset($this->request->getHeaders()[$name]) ?
            $this->request->getHeaders()[$name][0] : null;
    }
1225022
public function get(string $name, $default = null)
    {
        $key = strtolower($name);
        if (!array_key_exists($key, $this->headers)) {
            return $default;
        }

        return $this->headers[$key]->getValuesAsString();
    }
383725
public function get(string $name)
    {
        if (!array_key_exists($name, $this->headers)) {
            return null;
        }

        return $this->headers[$name];
    }
747427
public function get($name = null)
    {
        if (!$name) {
            return self::$_postTypes;
        }
        
        $name = ucfirst($name);

        if ($this->check($name)) {
            return self::$_postTypes[$name];
        }
        return false;
    }
124875
public function getHeader($name)
    {
        assert(is_string($name));

        $name = strtolower($name);

        if (isset($this->_headers[$name])) {
            return $this->_headers[$name];
        }

        return null;
    }
376051
public function getFirst($name)
    {
        $names = func_get_args();

        foreach ($names as $name) {
            if (isset($this->data[$name])) {
                return $this->data[$name];
            }
        }
    }
1341588
public function getResponseHeader($key, $first = true): string
    {
        $header = $this->response->getHeader($key);
        $headerFirst = $header[0] ?? '';
        return $first ? $headerFirst : $header;
    }
838316
public function getHeader($name)
    {
        if (empty($this->headers)) {
            if (function_exists('apache_request_headers')) {
                $this->headers = apache_request_headers();
            } else {
                $server = $_SERVER;
                foreach ($server as $key => $value) {
                    if (0 === strpos($key, 'HTTP_')) {
                        $key = str_replace('_', '-', strtolower(substr($key, 5)));
                        $this->headers[$key] = $value;
                    }
                }

                if (isset($server['CONTENT_TYPE'])) {
                    $this->headers['content-type'] = $server['CONTENT_TYPE'];
                }

                if (isset($server['CONTENT_LENGTH'])) {
                    $this->headers['content-length'] = $server['CONTENT_LENGTH'];
                }
            }

            $this->headers = array_change_key_case($this->headers);
        }

        $name = str_replace('_', '-', strtolower($name));
        return isset($this->headers[$name]) ? $this->headers[$name] : null;
    }
978689
function getFirstHeader (req, header) {
  const value = req.headers[header]
  return (Array.isArray(value) ? value[0] : value).split(', ')[0]
}
1041923
private function detectResponseHeaderValue($name)
    {
        $headers = $this->getResponseHeaders();

        return isset($headers[$name]) ? $headers[$name] : null;
    }
387488
public final function getHeaderValue($name)
    {
        self::checkString($name);

        foreach ($this->_headers as $headerName => $headerValue) {

            if (strcasecmp($name, $headerName) === 0) {

                return $headerValue;
            }
        }

        return null;
    }
563425
public function header($name, $default = null)
    {
        $header = $this->headers[strtolower($name)] ?? null;

        return $header ? $header->value() : $default;
    }