Determines whether two Request HTTP header sets are non-varying based on the vary response header value provided.
string $vary A Response vary header:
array $env1 A Request HTTP header array:
array $env2 A Request HTTP header array:
Boolean true if the two environments match, false otherwise
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;
}