public function etag($hash = null, $weak = false)
    {
        deprecationWarning(
            'Response::etag() is deprecated. ' .
            'Use withEtag() or getHeaderLine("Etag") instead.'
        );

        if ($hash !== null) {
            $this->_setHeader('Etag', sprintf('%s"%s"', $weak ? 'W/' : null, $hash));
        }

        if ($this->hasHeader('Etag')) {
            return $this->getHeaderLine('Etag');
        }

        return null;
    }
public function etag($hash = null, $weak = false)
    {
        deprecationWarning(
            'Response::etag() is deprecated. ' .
            'Use withEtag() or getHeaderLine("Etag") instead.'
        );

        if ($hash !== null) {
            $this->_setHeader('Etag', sprintf('%s"%s"', $weak ? 'W/' : null, $hash));
        }

        if ($this->hasHeader('Etag')) {
            return $this->getHeaderLine('Etag');
        }

        return null;
    }
public function etag ( $ hash = null , $ weak = false ) { deprecationWarning ( 'Response::etag() is deprecated. ' . 'Use withEtag() or getHeaderLine("Etag") instead.' ) ; if ( $ hash !== null ) { $ this -> _setHeader ( 'Etag' , sprintf ( '%s"%s"' , $ weak ? 'W/' : null , $ hash ) ) ; } if ( $ this -> hasHeader ( 'Etag' ) ) { return $ this -> getHeaderLine ( 'Etag' ) ; } return null ; }
Sets the response Etag, Etags are a strong indicative that a response
can be cached by a HTTP client. A bad way of generating Etags is
creating a hash of the response output, instead generate a unique
hash of the unique components that identifies a request, such as a
modification time, a resource Id, and anything else you consider it
makes it unique.

Second parameter is used to instruct clients that the content has
changed, but semantically, it can be used as the same thing. Think
for instance of a page with a hit counter, two different page views
are equivalent, but they differ by a few bytes. This leaves off to
the Client the decision of using or not the cached page.

If no parameters are passed, current Etag header is returned.

@param string|null $hash The unique hash that identifies this response
@param bool $weak Whether the response is semantically the same as
other with the same hash or not
@return string|null
@deprecated 3.4.0 Use withEtag() instead.
Sets the response Etag Etags are a strong indicative that a response can be cached by a HTTP client . A bad way of generating Etags is creating a hash of the response output instead generate a unique hash of the unique components that identifies a request such as a modification time a resource Id and anything else you consider it makes it unique .