Combine variable defaults

This commit is contained in:
Joe 2018-08-21 15:29:04 -04:00
parent a4e71b3b40
commit 8e7bc7701c

View file

@ -1162,15 +1162,13 @@ class CakeResponse {
public function checkNotModified(CakeRequest $request) {
$etags = preg_split('/\s*,\s*/', $request->header('If-None-Match'), null, PREG_SPLIT_NO_EMPTY);
$modifiedSince = $request->header('If-Modified-Since');
$etagMatches = $timeMatches = false;
if ($responseTag = $this->etag()) {
$etagMatches = in_array('*', $etags) || in_array($responseTag, $etags);
} else {
$etagMatches = false;
}
if ($modifiedSince) {
$timeMatches = strtotime($this->modified()) === strtotime($modifiedSince);
} else {
$timeMatches = false;
}
$checks = compact('etagMatches', 'timeMatches');
if (empty($checks)) {