Builds the value of the "Link" HTTP header.

@param LinkInterface[]|\Traversable $links

@return string|null
512041
public function serialize(iterable $links)
    {
        $elements = [];
        foreach ($links as $link) {
            if ($link->isTemplated()) {
                continue;
            }

            $attributesParts = ['', sprintf('rel="%s"', implode(' ', $link->getRels()))];
            foreach ($link->getAttributes() as $key => $value) {
                if (\is_array($value)) {
                    foreach ($value as $v) {
                        $attributesParts[] = sprintf('%s="%s"', $key, $v);
                    }

                    continue;
                }

                if (!\is_bool($value)) {
                    $attributesParts[] = sprintf('%s="%s"', $key, $value);

                    continue;
                }

                if (true === $value) {
                    $attributesParts[] = $key;
                }
            }

            $elements[] = sprintf('<%s>%s', $link->getHref(), implode('; ', $attributesParts));
        }

        return $elements ? implode(',', $elements) : null;
    }
338992
protected function composeListLink($link)
    {
        $query = $this->addIdToQuery();
        $query = $this->addPaginationToQuery($query);

        $link .= '?' . http_build_query($query);

        return $link;
    }
689367
protected function headerLink(array $routes)
    {
        $links = [];
        foreach ($routes as $rel => $route) {
            $links[] = '<' . $this->url . $route . '>; rel="' . $rel . '"';
        }
        return implode(', ', $links);
    }
1219015
function getHeaderValue($header){
		$header = strtolower($header);
		$headers = $this->getResponseHeaders(array("as_hash" => true, "lowerize_keys" => true));
		if(isset($headers["$header"])){ return $headers["$header"]; }
	}
1178116
protected function prepareLinkHeader()
    {
        $links = new LinkHeader(array());
        $links->add(
            new LinkHeaderItem(
                $this->router->generate('graviton.core.rest.app.all', array (), UrlGeneratorInterface::ABSOLUTE_URL),
                array ('rel' => 'apps', 'type' => 'application/json')
            )
        );

        return (string) $links;
    }
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;
    }
981796
protected function removeInvalidOrHiddenLinks(array $links): array
    {
        foreach ($links as $i => &$link) {
            if (!isset($link['target_page_id']) && !isset($link['url'])) {
                unset($links[$i]);

                continue;
            }

            $target = empty($link['target_page_id']) ? $link['url'] : $link['target_page_id'];

            $link = Link::factory($target, $link);

            if (!$link->isValid() || (!$this->editable && !$link->isVisible())) {
                unset($links[$i]);
            }
        }

        return array_values($links);
    }
420646
public function getLink($link)
    {
        if (isset($this->links->$link->redirectHref)) {
            return $this->links->$link->redirectHref;
        }

        if (isset($this->links->$link->href)) {
            return $this->links->$link->href;
        }

        return $this->links->$link;
    }
1342457
protected function buildHeaders($headers) 
    {
        $string = '';
        foreach($headers as $key => $value) {
            if(empty($value)) continue;
            $string .= $key. ': '. $value. "\r\n";
        }
        return $string;
    }
1010385
public function setHeader($header = null)
    {
        if (is_null($header) && $this->getMethod() == "POST") {
            $host = $this->getHost();

            $header = [];
            $header[] = 'POST /cgi-bin/webscr HTTP/1.1';
            $header[] = 'Content-Type: application/x-www-form-urlencoded';
            if (isset($host)) {
                $header[] = 'Host: ' . $host;
            }
            $header[] = 'Connection: close';
        }
        $this->_aHeader = $header;
    }
395005
public function getHeader($header)
    {
        if (array_key_exists($header, $this->responseHeaders)) {
            return $this->responseHeaders[$header];
        }
        // Do case-insensitive search
        foreach ($this->responseHeaders as $k => $v) {
            if (strtolower($k) == strtolower($header)) {
                return $v;
            }
        }
    }
1228394
private function setHeaderLink(array $linkEntries)
    {
        $values = [];
        foreach ($linkEntries as $linkEntry) {
            \PHPUnit\Framework\Assert::assertArrayHasKey(
                'uri',
                $linkEntry,
                'linkEntry should contain property "uri"'
            );
            \PHPUnit\Framework\Assert::assertArrayHasKey(
                'link-param',
                $linkEntry,
                'linkEntry should contain property "link-param"'
            );
            $values[] = $linkEntry['uri'] . '; ' . $linkEntry['link-param'];
        }

        $this->haveHttpHeader('Link', implode(', ', $values));
    }
261442
protected function serializeLink(LinkInterface $link)
    {
        if (!$link->metaInformation()->isEmpty()) {
            return [
                'href' => $link->href(),
                'meta' => $link->metaInformation()->all(),
            ];
        }

        return $link->href();
    }
159780
private function addLinkHeader ($link)
    {
        $headers = Craft::$app->getResponse()->getHeaders();

        if ( $headers->get('Link') ) {
            $link = $headers->get('Link') . ',' . $link;
        }

        $headers->set('Link', $link);
    }
921413
public static function toString($args, $link  = '') {
		$str = '';
		if (is_array($args)) {
			foreach ($args as $value) {
				$str .= self::toString($value, $link);
			}
		} else {
			$str .= $args.$link;
		}
		return $str;
	}
228656
private function parseWeblink($linkHeader)
    {
        $links = [];

        while (preg_match('/^((?:[^"]|"[^"]*")*?),/', $linkHeader, $matches)) {
            $linkHeader  = trim(substr($linkHeader, strlen($matches[0])));
            $links[] = Weblink::fromHeaderString($matches[1]);
        }

        if ($linkHeader) {
            $links[] = Weblink::fromHeaderString($linkHeader);
        }

        return $links;
    }
422011
protected function link($link, $anchor = "") {
        $link = trim($link);
        if (preg_match("/^(https?|s?ftp):\/\/.+$/i", $link)) {
            $link = trim($link, ",.?!");
            return array('content' => $link, 'url' => $link);
        } else {
            $callbackargs = $this->linkgeneratorcallbackargs;
            $callbackargs['anchor'] = $anchor;
            $link = call_user_func_array($this->linkgeneratorcallback, array($link, $callbackargs));

            if (isset($link['link_info'])) {
                $l = $link['link_info']['link'];
                unset($link['link_info']['link']);
                $this->returnvalues['link_count'][$l] = $link['link_info'];
            }
            return $link;
        }
    }