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