You are here

public function Response::getExpires in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-foundation/Response.php \Symfony\Component\HttpFoundation\Response::getExpires()

Returns the value of the Expires header as a DateTime instance.

Return value

\DateTime|null A DateTime instance or null if the header does not exist

1 call to Response::getExpires()
Response::getMaxAge in vendor/symfony/http-foundation/Response.php
Returns the number of seconds after the time specified in the response's Date header when the response should no longer be considered fresh.

File

vendor/symfony/http-foundation/Response.php, line 662

Class

Response
Response represents an HTTP response.

Namespace

Symfony\Component\HttpFoundation

Code

public function getExpires() {
  try {
    return $this->headers
      ->getDate('Expires');
  } catch (\RuntimeException $e) {

    // according to RFC 2616 invalid date formats (e.g. "0" and "-1") must be treated as in the past
    return \DateTime::createFromFormat(DATE_RFC2822, 'Sat, 01 Jan 00 00:00:00 +0000');
  }
}