/** * Determines whether two Request HTTP header sets are non-varying based on * the vary response header value provided. * * @param string $vary A Response vary header * @param array $env1 A Request HTTP header array * @param array $env2 A Request HTTP header array * * @return Boolean true if the the two environments match, false otherwise */ public function requestsMatch($vary, $env1, $env2) { if (empty($vary)) { return true; } foreach (preg_split('/[\\s,]+/', $vary) as $header) { $key = HeaderBag::normalizeHeaderName($header); $v1 = isset($env1[$key]) ? $env1[$key] : null; $v2 = isset($env2[$key]) ? $env2[$key] : null; if ($v1 !== $v2) { return false; } } return true; }