Get/set the headers instance

@param  string $headers The headers instance
@return string
771054
public function headers($headers = null)
    {
        if (!func_num_args()) {
            return $this->_stream->headers();
        }
        $this->_stream->headers($headers);
        return $this;
    }
1100917
public function exposeHeaders($headers = '*')
    {
        $this->response = $this->corsHandler->setResponse($this->response)
            ->exposeHeaders($headers)
            ->getResponse();

        return $this;
    }
1194376
private function determineHeaderStringForSignedResponse(array $headers)
    {
        $signedDataHeaders = [];
        ksort($headers);

        foreach ($headers as $headerName => $headerValue) {
            // All headers with the prefix 'X-Bunq-' except 'Server-Signature' need to be signed.
            $headerName = $this->ensureHeaderIsCorrectlyCased($headerName);

            if ($headerName === self::HEADER_SERVER_SIGNATURE) {
                // Skip this header
            } elseif (strpos($headerName, self::HEADER_PREFIX) === self::HEADER_PREFIX_START) {
                $signedDataHeaders[] = $this->determineHeaderStringLine($headerName, $headerValue);
            }
        }

        return implode(self::NEWLINE, $signedDataHeaders);
    }
1201165
public static function create($headers)
    {
        $result = new self();
        $result->_requestId = Utilities::tryGetValue(
            $headers,
            Resources::X_MS_REQUEST_ID
        );

        return $result;
    }
1187872
public function exposeHeaders($headers = '*')
    {
        $headers = array_map([HeaderHelper::class, 'normalizeHeaderName'], (array) $headers);
        $headers = implode(', ', $headers);

        $this->response = $this->response->withHeader('Access-Control-Allow-Headers', $headers);

        return $this;
    }
1363971
protected function headers($headers)
    {
        foreach($headers as $name => $lines) {
            foreach($lines as $key => $line) {
                $this->header("$name: $line", false);
            }
        }
    }
193774
public function withHeaders( array $headers )
	{
		foreach ( $headers as $key => $value )
		{
			$this->headers->set( $key, $value );
		}

		return $this;
	}
1278725
public function getToken($headers = null)
    {
        $token = null;
        try {
            if (is_null($headers)) {
                if (!function_exists('apache_request_headers()')) {
                    function apache_request_headers()
                    {
                        foreach($_SERVER as $key=>$value) {
                            if (substr($key,0,5)=="HTTP_") {
                                $key=str_replace(" ","-",ucwords(strtolower(str_replace("_"," ",substr($key,5)))));
                            }
                            $out[$key]=$value;
                        }
                        return $out;
                    }
                }
                $headers = apache_request_headers();
            }
            if (isset($headers[$this->config['header']['auth']]) && isset($headers[$this->config['header']['ident']])) {
                $tokenValue = $headers[$this->config['header']['auth']];
                $ident      = $headers[$this->config['header']['ident']];
                if (preg_match('/(?P<type>[a-z\d]+) (?P<noised>.*)/i', $tokenValue, $rs)) {
                    $token  = $this->getTokenFromString($rs['noised'], $ident);
                    if ($token->getType() != $rs['type']) {
                        throw new \Exception('wrong type');
                    }
                }
            }
            else {
                throw new \Exception('missing required headers');
            }
        }
        catch(\Exception $e) {
            throw new AuthenticateException("invalid authentication protocol : ".$e->getMessage());
        }
        return $token;
    }
926764
function setHeaders($headers)
    {
        if ($headers instanceof iHeaders) {
            $tHeaders = array();
            foreach($headers as $h)
                $tHeaders[] = $h;
            $headers = $tHeaders;
        }

        if (! is_array($headers) )
            throw new \InvalidArgumentException;

        foreach ($headers as $label => $h) {
            if (! $h instanceof iHeader ) {
                if (is_int($label) && is_string($h))
                    // ['X-Powered-By: PHP/5.5.9-1ubuntu4.16', ]
                    // in form of headers_list()
                    $valuable = $h;
                else
                    $valuable = array($label => $h);
                        
                $h = FactoryHttpHeader::of($valuable);
            }

            $this->headers()->insert($h);
        }

        return $this;
    }
1219015
function getHeaderValue($header){
		$header = strtolower($header);
		$headers = $this->getResponseHeaders(array("as_hash" => true, "lowerize_keys" => true));
		if(isset($headers["$header"])){ return $headers["$header"]; }
	}
1177066
private function setHeaders($headers) {
        // Make array of the different headers
        $headers = explode(PHP_EOL, $headers);

        foreach ($headers as $header) {
            // Cut the header into pieces
            $header = explode(': ', $header);

            // Skip header if it's not in the default format
            if (!is_array($header) && count($header) === 1) {
                continue;
            }

            // Get the header type
            $type = strtolower(array_shift($header));

            // Glue the header back together
            $value = implode(': ', $header);

            // Skip header if the type or value is empty
            if (empty($type) || empty($value)) {
                continue;
            }

            // Store the header
            $this->headers[$type] = trim($value);
        }
    }
695649
public function setHeaders(array $headers)
    {
        if ($headers) {
            $this->headers = array_merge($this->headers, $headers);
        }

        return $this;
    }
1342457
protected function buildHeaders($headers) 
    {
        $string = '';
        foreach($headers as $key => $value) {
            if(empty($value)) continue;
            $string .= $key. ': '. $value. "\r\n";
        }
        return $string;
    }
1339310
protected function setHeaders($headers)
    {
        foreach ($headers as $name => $value) {

            //~ Convert to array
            if (!is_array($value)) {
                $value = [$value];
            }

            //~ Clean values
            foreach ($value as $key => $val) {
                $value[$key] = trim($val);
            }

            $this->headersOriginal[$name]     = $value;
            $this->headers[strtolower($name)] = $value;
        }

        return $this;
    }
649552
public function setCustomHeaders(array $headers)
    {
        foreach ($headers as $k => &$v) {
            if (strpos($v, ':') === false) {
                $v = $k.': '.$v;
            }
        }
        $this->headers = $headers;
    }
603306
public function withHeaders(array $headers): self
    {
        return tap($this, function ($request) use ($headers) {
            return $this->options = array_merge_recursive($this->options, [
                'headers' => $headers,
            ]);
        });
    }
1092982
public function determineHeaderStringForSignedRequest(array $headers): string
    {
        $signedDataHeaderString = self::SIGNED_DATA_EMPTY_STRING;
        ksort($headers);

        foreach ($headers as $headerName => $headerValue) {
            // Not all headers should be signed.
            // The User-Agent and Cache-Control headers need to be signed.
            if ($headerName === self::HEADER_USER_AGENT || $headerName === self::HEADER_CACHE_CONTROL) {
                $signedDataHeaderString .= self::NEWLINE;
                $signedDataHeaderString .= $this->determineHeaderStringLine($headerName, $headerValue);
            }

            // All headers with the prefix 'X-Bunq-' except 'Server-Signature' need to be signed.
            if ($headerName === self::HEADER_SERVER_SIGNATURE) {
                // Skip this header
            } elseif (strpos($headerName, self::HEADER_PREFIX) === self::HEADER_PREFIX_START) {
                $signedDataHeaderString .= self::NEWLINE;
                $signedDataHeaderString .= $this->determineHeaderStringLine($headerName, $headerValue);
            }
        }

        return $signedDataHeaderString;
    }