You are here

private function Store::requestsMatch in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/HttpCache/Store.php \Symfony\Component\HttpKernel\HttpCache\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

bool true if the two environments match, false otherwise

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

File

vendor/symfony/http-kernel/HttpCache/Store.php, line 262

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;
}