private function Store::requestsMatch

Determines whether two Request HTTP header sets are non-varying based on the vary response header value provided.

Parameters

string $vary A Response vary header:

array $env1 A Request HTTP header array:

array $env2 A Request HTTP header array:

Return value

Boolean true if the two environments match, false otherwise

2 calls to Store::requestsMatch()
Store::lookup in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Store.php
Locates a cached Response for the Request provided.
Store::write in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Store.php
Writes a cache entry to the store for the given Request and Response.

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Store.php, line 261

Class

Store
Store implements all the logic for storing cache metadata (Request and Response headers).

Namespace

Symfony\Component\HttpKernel\HttpCache

Code

private function requestsMatch($vary, $env1, $env2) {
  if (empty($vary)) {
    return true;
  }
  foreach (preg_split('/[\\s,]+/', $vary) as $header) {
    $key = strtr(strtolower($header), '_', '-');
    $v1 = isset($env1[$key]) ? $env1[$key] : null;
    $v2 = isset($env2[$key]) ? $env2[$key] : null;
    if ($v1 !== $v2) {
      return false;
    }
  }
  return true;
}