public function withEtag(ResponseInterface $response, $value, $type = 'strong')
    {
        if (!in_array($type, ['strong', 'weak'])) {
            throw new InvalidArgumentException('Invalid etag type. Must be "strong" or "weak".');
        }
        $value = '"' . $value . '"';
        if ($type === 'weak') {
            $value = 'W/' . $value;
        }

        return $response->withHeader('ETag', $value);
    }
public function withEtag(ResponseInterface $response, $value, $type = 'strong')
    {
        if (!in_array($type, ['strong', 'weak'])) {
            throw new InvalidArgumentException('Invalid etag type. Must be "strong" or "weak".');
        }
        $value = '"' . $value . '"';
        if ($type === 'weak') {
            $value = 'W/' . $value;
        }

        return $response->withHeader('ETag', $value);
    }
public function withEtag ( ResponseInterface $ response , $ value , $ type = 'strong' ) { if ( ! in_array ( $ type , [ 'strong' , 'weak' ] ) ) { throw new InvalidArgumentException ( 'Invalid etag type. Must be "strong" or "weak".' ) ; } $ value = '"' . $ value . '"' ; if ( $ type === 'weak' ) { $ value = 'W/' . $ value ; } return $ response -> withHeader ( 'ETag' , $ value ) ; }
Add `ETag` header to PSR7 response object

@param  ResponseInterface $response A PSR7 response object
@param  string            $value    The ETag value
@param  string            $type     ETag type: "strong" or "weak"

@return ResponseInterface           A new PSR7 response object with `ETag` header
@throws InvalidArgumentException if the etag type is invalid
Add ETag header to PSR7 response object