public function Response::isNotModified in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-foundation/Response.php \Symfony\Component\HttpFoundation\Response::isNotModified()
Determines if the Response validators (ETag, Last-Modified) match a conditional value specified in the Request.
If the Response is not modified, it sets the status code to 304 and removes the actual content by calling the setNotModified() method.
Parameters
Request $request A Request instance:
Return value
bool true if the Response validators match the Request, false otherwise
File
- vendor/
symfony/ http-foundation/ Response.php, line 997
Class
- Response
- Response represents an HTTP response.
Namespace
Symfony\Component\HttpFoundationCode
public function isNotModified(Request $request) {
if (!$request
->isMethodSafe()) {
return false;
}
$notModified = false;
$lastModified = $this->headers
->get('Last-Modified');
$modifiedSince = $request->headers
->get('If-Modified-Since');
if ($etags = $request
->getETags()) {
$notModified = in_array($this
->getEtag(), $etags) || in_array('*', $etags);
}
if ($modifiedSince && $lastModified) {
$notModified = strtotime($modifiedSince) >= strtotime($lastModified) && (!$etags || $notModified);
}
if ($notModified) {
$this
->setNotModified();
}
return $notModified;
}