Sets the Last-Modified HTTP header with a DateTime instance.
Passing null as value will remove the header.
@api
\DateTime|null $date A \DateTime instance or null to remove the header:
public function setLastModified(\DateTime $date = null) {
if (null === $date) {
$this->headers
->remove('Last-Modified');
}
else {
$date = clone $date;
$date
->setTimezone(new \DateTimeZone('UTC'));
$this->headers
->set('Last-Modified', $date
->format('D, d M Y H:i:s') . ' GMT');
}
return $this;
}