($reportMetadata)
| 175 | } |
| 176 | |
| 177 | private function evaluateIfNoneMatch($reportMetadata) { |
| 178 | $clientETag = $this->getRequestCacheKey(); |
| 179 | if ($clientETag !== null && $clientETag !== '') { |
| 180 | $clientETag = (int)$clientETag; |
| 181 | // Compare with your current version/etag |
| 182 | if ($clientETag === (int)$reportMetadata['version']) { |
| 183 | $response = new DataResponse(null, HTTP::STATUS_NOT_MODIFIED); |
| 184 | $response->addHeader('ETag', '"' . $reportMetadata['version'] . '"'); |
| 185 | $response->addHeader('X-Analytics-Cacheable', 'true'); |
| 186 | return $response; |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | private function getRequestCacheKey(): ?string { |
| 192 | $clientETag = $this->request->getHeader('If-None-Match'); |
no test coverage detected