mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Combine variable defaults
This commit is contained in:
parent
a4e71b3b40
commit
8e7bc7701c
1 changed files with 1 additions and 3 deletions
|
@ -1162,15 +1162,13 @@ class CakeResponse {
|
||||||
public function checkNotModified(CakeRequest $request) {
|
public function checkNotModified(CakeRequest $request) {
|
||||||
$etags = preg_split('/\s*,\s*/', $request->header('If-None-Match'), null, PREG_SPLIT_NO_EMPTY);
|
$etags = preg_split('/\s*,\s*/', $request->header('If-None-Match'), null, PREG_SPLIT_NO_EMPTY);
|
||||||
$modifiedSince = $request->header('If-Modified-Since');
|
$modifiedSince = $request->header('If-Modified-Since');
|
||||||
|
$etagMatches = $timeMatches = false;
|
||||||
if ($responseTag = $this->etag()) {
|
if ($responseTag = $this->etag()) {
|
||||||
$etagMatches = in_array('*', $etags) || in_array($responseTag, $etags);
|
$etagMatches = in_array('*', $etags) || in_array($responseTag, $etags);
|
||||||
} else {
|
} else {
|
||||||
$etagMatches = false;
|
|
||||||
}
|
}
|
||||||
if ($modifiedSince) {
|
if ($modifiedSince) {
|
||||||
$timeMatches = strtotime($this->modified()) === strtotime($modifiedSince);
|
$timeMatches = strtotime($this->modified()) === strtotime($modifiedSince);
|
||||||
} else {
|
|
||||||
$timeMatches = false;
|
|
||||||
}
|
}
|
||||||
$checks = compact('etagMatches', 'timeMatches');
|
$checks = compact('etagMatches', 'timeMatches');
|
||||||
if (empty($checks)) {
|
if (empty($checks)) {
|
||||||
|
|
Loading…
Reference in a new issue