You are here

public static function HttpHelpers::findLinkHeader in Feeds 8.3

Finds a relation type in a header array.

Parameters

array $headers: The header array.

string $relation: The type of relation to find.

Return value

string|false The link, or false.

2 calls to HttpHelpers::findLinkHeader()
HttpHelpersTest::testFindLinkHeader in tests/src/Unit/Component/HttpHelpersTest.php
Tests finding relation links in several headers.
PubSubHubbub::findRelation in src/EventSubscriber/PubSubHubbub.php
Finds a hub from a fetcher result.

File

src/Component/HttpHelpers.php, line 25

Class

HttpHelpers
Various helpers for dealing with HTTP data.

Namespace

Drupal\feeds\Component

Code

public static function findLinkHeader(array $headers, $relation) {
  $headers = array_change_key_case($headers);
  if (!isset($headers['link'])) {
    return FALSE;
  }
  foreach ((array) $headers['link'] as $link) {
    if ($link = static::parseLinkRelation($link, $relation)) {
      return $link;
    }
  }
  return FALSE;
}