You are here

public function Response::setEtag in Zircon Profile 8

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

Sets the ETag value.

Parameters

string|null $etag The ETag unique identifier or null to remove the header:

bool $weak Whether you want a weak ETag or not:

Return value

Response

2 calls to Response::setEtag()
BinaryFileResponse::setAutoEtag in vendor/symfony/http-foundation/BinaryFileResponse.php
Automatically sets the ETag header according to the checksum of the file.
Response::setCache in vendor/symfony/http-foundation/Response.php
Sets the response's cache headers (validation and/or expiration).

File

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

Class

Response
Response represents an HTTP response.

Namespace

Symfony\Component\HttpFoundation

Code

public function setEtag($etag = null, $weak = false) {
  if (null === $etag) {
    $this->headers
      ->remove('Etag');
  }
  else {
    if (0 !== strpos($etag, '"')) {
      $etag = '"' . $etag . '"';
    }
    $this->headers
      ->set('ETag', (true === $weak ? 'W/' : '') . $etag);
  }
  return $this;
}