Returns the headers as a string.

@return string
3384
public static function toHeader($headers, $options = [])
    {
        $data = [];
        foreach ($headers as $key => $header) {
            $data[] = $header->to('header', $options);
        }
        return $data ? join(self::EOL, $data) : '';
    }
1203339
public function toArray()
    {
        $headers = array();

        //Method to implode header parameters
        $implode = function($parameters)
        {
            $results = array();
            foreach ($parameters as $key => $parameter)
            {
                if(!is_numeric($key))
                {
                    //Parameters
                    if(is_array($parameter))
                    {
                        $modifiers = array();
                        foreach($parameter as $k => $v) {
                            $modifiers[] = $k.'='.$v;
                        }

                        $results[] = $key.';'.implode($modifiers, ',');
                    }
                    else $results[] = $key.'='.$parameter;
                }
                else $results[] = $parameter;
            }

            return $value = implode($results, ', ');
        };

        //Serialise the headers to an array
        ksort($this->_data);
        foreach ($this->_data as $name => $values)
        {
            $name    = implode('-', array_map('ucfirst', explode('-', $name)));
            $results = array();

            foreach($values as $value)
            {
                if(is_array($value)) {
                    $results[] = $implode($value);
                }  else {
                    $results[] = $value;
                }
            }

            if ($value = implode($results, ', ')) {
                $headers[$name] = $value;
            }
        }

        return $headers;
    }
731701
public function dumpString(): string
    {
        if ($this->header === null) {
            $this->header = new PoHeader;
            $this->header->buildDefaultHeader();
        }
        $output = '';

        $output .= $this->header->dumpEntry();
        foreach ($this->entries as $entry) {
            $output .= $entry->dumpEntry();
        }
        foreach ($this->unkeyedEntries as $entry) {
            $output .= $entry->dumpEntry();
        }
        $output .= "\n";

        return $output;
    }
447769
public function toString()
    {
        $response = Parser\ResponseParser::buildStatusLine($this) . Http::NEW_LINE;
        $headers  = Parser\ResponseParser::buildHeaderFromMessage($this);

        foreach ($headers as $header) {
            $response.= $header . Http::NEW_LINE;
        }

        $response.= Http::NEW_LINE;
        $response.= (string) $this->getBody();

        return $response;
    }
768315
public function toHeader()
    {
        $out = 'Authorization: OAuth realm=""';
        foreach ($this->parameters as $k => $v) {
            if (substr($k, 0, 5) != "oauth") {
                continue;
            }
            if (is_array($v)) {
                throw new Exception('Arrays not supported in headers');
            }
            $out .= ',' .
                Util::urlencodeRfc3986($k) .
                '="' .
                Util::urlencodeRfc3986($v) .
                '"';
        }
        return $out;
    }
625817
public function getHeaderStr()
    {
        $headers = [];
        foreach ($this->getHeaders() as $co => $vo) {
            foreach ($vo as $ko) {
                $headers[] = $co . ': ' . $ko;
            }
        }
        return $headers;
    }
256582
public function getHeaders(): array
    {
        if ($this->headers === null && $this->headersText !== null) {
            $this->headers = [];

            foreach (explode("\n", $this->headersText) as $line) {
                $pos = strpos($line, ':');

                if ($pos === false) {
                    // this is one-line header
                    $this->headers[$line] = null;
                } else {
                    $name = substr($line, 0, $pos);
                    $value = substr($line, $pos + 1);
                    $this->headers[$name] = trim($value);
                }
            }
        }

        return $this->headers ?? [];
    }
549151
public function getHeader() : string
    {
        $salt = $this->getEncodedSalt();
        $hmac = $this->getEncodedHMAC();

        if ($this->version === 2) {
            $data = \base64_encode(\json_encode([
                'access_token' => $this->token->accessToken,
                'date' => $this->date,
                'hmac' => $hmac,
                'salt' => $salt,
                'v' => 2
            ]));

            return "HMAC {$data}";
        }

        // The version 1 HMAC is returned by default
        return "HMAC {$this->token->accessToken},{$hmac},{$salt}";
    }
760430
public function getHeaders(): array
    {
        $result = [];
        foreach ($this->headers as $headerInfo) {
            $result[$headerInfo[0]] = $headerInfo[1];
        }

        return $result;
    }
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;
    }
680112
public function getHeader()
    {
        switch ($this->type) {
            case self::TYPE_ERROR:
                $header = 'Error!';
                break;
            case self::TYPE_WARNING:
                $header = 'Warning!';
                break;
            case self::TYPE_INFO:
                $header = 'Info';
                break;
            case self::TYPE_SUCCESS:
                $header = 'Success';
                break;
            default:
                $header = 'Info';
                break;
        }

        return $header;
    }
468731
public function getHeaders()
    {
        // Define a headers array
        $headers = array();

        foreach ($this->attributes as $key => $value) {
            // Does our server attribute have our header prefix?
            if (self::hasPrefix($key, self::$http_header_prefix)) {
                // Add our server attribute to our header array
                $headers[
                    substr($key, strlen(self::$http_header_prefix))
                ] = $value;

            } elseif (in_array($key, self::$http_nonprefixed_headers)) {
                // Add our server attribute to our header array
                $headers[$key] = $value;
            }
        }

        return $headers;
    }
2316
public function toHeaders(): array
    {
        $headers = [];
        foreach ($this as $name => $properties) {
            $headers[] = $this->toHeaderLine($name, $properties);
        }

        return $headers;
    }
561629
public function headers()
	{
		if (!$this->headers)
		{
			$this->rewind();

			$row = fgetcsv($this->file, self::ROW_LENGTH, $this->delimiter);

			$this->position++;

			// store headers for later
			if ($this->position == 1)
			{
				$this->headers = $row;
			}

			$this->rewind();
		}

		return $this->headers;
	}
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;
    }
39545
private function parseHeadersFormat()
    {
        $headers = array();
        foreach($this->request->getHeaders() as $name => $value)
        {
            $headers[] = $name . ':' . implode(',', $value);
        }
        return $headers;
    }
1063571
public function getRawHeaders(): string
    {
        if (null === $this->rawHeaders) {
            $rawHeaders       = \explode("\r\n\r\n", $this->getRawMessage(), 2);
            $this->rawHeaders = \current($rawHeaders);
        }

        return $this->rawHeaders;
    }