Generates the headers to be send with the request.

@return string[] Array of HTTP headers.
182778
public function getHeaders()
    {
        $headers = $this->header;
        $headers[] = 'User-Agent: ' . $this->getUserAgent();
        $itemId = $this->indexQueueItem->getIndexQueueUid();
        $pageId = $this->indexQueueItem->getRecordPageId();

        $indexerRequestData = [
            'requestId' => $this->requestId,
            'item' => $itemId,
            'page' => $pageId,
            'actions' => implode(',', $this->actions),
            'hash' => md5(
                $itemId . '|' .
                $pageId . '|' .
                $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']
            )
        ];

        $indexerRequestData = array_merge($indexerRequestData, $this->parameters);
        $headers[] = 'X-Tx-Solr-Iq: ' . json_encode($indexerRequestData, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_UNESCAPED_SLASHES);

        return $headers;
    }
291680
public function getResponseHeaders() {
        $requestHeaders = [];

        if ($this->headers instanceof \ArrayAccess) {
            while ($this->headers->valid()) {
                $requestHeaders[$this->headers->key()] = $this->headers->current();
                $this->headers->next();
            }
        }

        return $requestHeaders;
    }
439390
protected function buildHeaders(): array
    {
        $this->headers = [
            'User-Agent' => 'Cog-YouTrack-REST-PHP/' . self::VERSION,
            'Accept' => 'application/json',
        ];

        $this->authorizer->appendHeadersTo($this);

        return $this->headers;
    }
505998
public static function get_headers(): array
	{
		if (function_exists('apache_request_headers')) {
			// we need this to get the actual Authorization: header
			// because apache tends to tell us it doesn't exist
			$headers = apache_request_headers();

			// sanitize the output of apache_request_headers because
			// we always want the keys to be Cased-Like-This and arh()
			// returns the headers in the same case as they are in the
			// request
			$out = [];
			foreach ($headers as $key => $value) {
				$key = str_replace(
					' ',
					'-',
					ucwords(strtolower(str_replace('-', ' ', $key)))
				);
				$out[$key] = $value;
			}
		} else {
			// otherwise we don't have apache and are just going to have to hope
			// that $_SERVER actually contains what we need
			$out = [];
			if (isset($_SERVER['CONTENT_TYPE'])) {
				$out['Content-Type'] = $_SERVER['CONTENT_TYPE'];
			}
			if (isset($_ENV['CONTENT_TYPE'])) {
				$out['Content-Type'] = $_ENV['CONTENT_TYPE'];
			}

			foreach ($_SERVER as $key => $value) {
				if (substr($key, 0, 5) == 'HTTP_') {
					// this is chaos, basically it is just there to capitalize the first
					// letter of every word that is not an initial HTTP and strip HTTP
					// code from przemek
					$key = str_replace(
						' ',
						'-',
						ucwords(strtolower(str_replace('_', ' ', substr($key, 5))))
					);
					$out[$key] = $value;
				}
			}
		}
		return $out;
	}
625067
public function getHeaders()
    {
        $headers = array();
        foreach ($this->response->getHeaders()->getAll() as $header => $headerObject) {
            $allHeaderValues = $headerObject->toArray();
            $headers[strtolower($header)] = implode(';', $allHeaderValues);
        }

        return $headers;
    }
1370271
public static function requestHeaders()
    {
        $headers = [];
        foreach ($_SERVER as $key => $value) {
            if ('HTTP_' == substr($key, 0, 5)) {
                $headers[str_replace('_', '-', substr($key, 5))] = $value;
            }
        }
        return $headers;
    }
248443
public function sendHeaders()
	{
		// headers have already been sent by the developer
		if (headers_sent()) {
			return $this;
		}

		// status
		header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);

		// headers
		foreach ($this->headers as $name => $values) {
			if (is_array($values))
			{
				foreach ($values as $value)
				{
					header($name . ': ' . $value, false, $this->statusCode);
				}
			}
			else
			{
				header($name . ': ' . $values, false, $this->statusCode);
			}
		}

		return $this;
	}
404475
public function sendHeaders()
    {
        // headers have already been sent by the developer
        if (headers_sent()) {
            return $this;
        }

        // headers
        foreach ($this->headers->allPreserveCaseWithoutCookies() as $name => $values) {
            $replace = 0 === strcasecmp($name, 'Content-Type');
            foreach ($values as $value) {
                header($name.': '.$value, $replace, $this->statusCode);
            }
        }

        // cookies
        foreach ($this->headers->getCookies() as $cookie) {
            header('Set-Cookie: '.$cookie->getName().strstr($cookie, '='), false, $this->statusCode);
        }

        // status
        header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);

        return $this;
    }
321328
public function getHeaders()
    {
        $return = array();

        foreach ($this->contents as $key => $value) {
            if (strpos($key, self::$HttpPrefix) === 0) { // @codeCoverageIgnore
                $return[substr($key, strlen(self::$HttpPrefix))] = $value; // @codeCoverageIgnore
            } // @codeCoverageIgnore

            if (in_array($key, self::$HttpCustomHeaders)) {
                $return[$key] = $value;
            }
        }

        return $return;
    }
1183215
public function sendHeaders()
    {
        // headers have already been sent by the developer
        if (headers_sent()) {
            return $this;
        }

        /* RFC2616 - 14.18 says all Responses need to have a Date */
        if (!$this->headers->has('Date')) {
            $this->setDate(\DateTime::createFromFormat('U', time()));
        }

        // headers
        foreach ($this->headers->allPreserveCaseWithoutCookies() as $name => $values) {
            foreach ($values as $value) {
                header($name.': '.$value, false, $this->statusCode);
            }
        }

        // status
        header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);

        // cookies
        foreach ($this->headers->getCookies() as $cookie) {
            if ($cookie->isRaw()) {
                setrawcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
            } else {
                setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
            }
        }

        return $this;
    }
308446
public function sendHeaders()
    {
        if (!headers_sent()) {
            foreach ($this->headers as $header) {
                header($header, true);
            }
        }

        $this->headers = array();
        return $this;
    }
954672
public function getHeaders()
	{
		// Define a headers array
		$headers = [];

		foreach($this->items as $key => $value)
		{
			// Does our server attribute have our header prefix ?
			if(strpos($key, $this->http_header_prefix) === 0)
			{
				$key = substr($key, strlen($this->http_header_prefix));
			}
			else if(! in_array($key, $this->http_nonprefixed_headers))
			{
				continue;
			}

			$key = HeaderCollection::normalizeKey($key);

			// Add our server attribute to our header array
			$headers[$key] = $value;
		}

		return $headers;
	}
364548
private static function getCurrentRequestHeaders() : array
    {
        $headers = [];

        if (function_exists('apache_request_headers')) {
            $requestHeaders = apache_request_headers();

            if ($requestHeaders) {
                foreach ($requestHeaders as $key => $value) {
                    $key = strtolower($key);
                    $headers[$key] = [$value];
                }

                return $headers;
            }
        }

        foreach ($_SERVER as $key => $value) {
            if (substr($key, 0, 5) === 'HTTP_') {
                $key = substr($key, 5);
            } elseif ($key !== 'CONTENT_TYPE' && $key !== 'CONTENT_LENGTH') {
                continue;
            }

            $key = strtolower(str_replace('_', '-', $key));
            $headers[$key] = [$value];
        }

        return $headers;
    }
317209
public function getHeaders()
    {
        $headers = array_merge(
            $this->getRequestLineHeaders(),
            $this->getStandardHeaders(),
            $this->getCookieHeaders()
        );

        return $headers;
    }
107931
public function getHeaders()
    {
        $h = array();
        if (!empty($this->timeout))
            $h['Refresh'] = $this->timeout . '; url=' . $this->url;
        else
            $h['Location'] = (string)$this->url;
        return $h;
    }
1347086
protected function buildHeaders()
    {
        $headers = array();
        foreach ($this->headers as $key => $value) {
            if ($key == 'CC' || $key == 'BCC') {
                $value = implode(', ', $value);
            }
            array_push($headers, sprintf('%s: %s', $key, $value));
        }

        if (!empty($this->attachments)) {
            array_push(
                $headers,
                "Content-Type: multipart/mixed; boundary=\"{$this->boundaryMixed}\""
            );
        } elseif (!empty($this->plainMessage) && !empty($this->htmlMessage)) {
            array_push(
                $headers,
                "Content-Type: multipart/alternative; boundary=\"{$this->boundaryAlternative}\""
            );
        } elseif (!empty($this->htmlMessage)) {
            array_push(
                $headers,
                'Content-type: text/html; charset="iso-8859-1"'
            );
        }

        return implode(self::LINE_BREAK, $headers);
    }
250712
public function getAll() : array
    {
        $headers = [];
        foreach ($this->headers as $h => $v) {
            $headers[] = $h.': '.$v;
        }

        return $headers;
    }