MCPcopy Create free account
hub / github.com/Rello/analytics / evaluateIfNoneMatch

Method evaluateIfNoneMatch

lib/Controller/OutputController.php:214–226  ·  view source on GitHub ↗
($reportMetadata)

Source from the content-addressed store, hash-verified

212 }
213
214 private function evaluateIfNoneMatch($reportMetadata) {
215 $clientETag = $this->getRequestCacheKey();
216 if ($clientETag !== null && $clientETag !== '') {
217 $clientETag = (int)$clientETag;
218 // Compare with your current version/etag
219 if ($clientETag === (int)$reportMetadata['version']) {
220 $response = new DataResponse(null, HTTP::STATUS_NOT_MODIFIED);
221 $response->addHeader('ETag', '"' . $reportMetadata['version'] . '"');
222 $response->addHeader('X-Analytics-Cacheable', 'true');
223 return $response;
224 }
225 }
226 }
227
228 private function getRequestCacheKey(): ?string {
229 $clientETag = $this->request->getHeader('If-None-Match');

Callers 2

readMethod · 0.95
readPanoramaMethod · 0.95

Calls 2

getRequestCacheKeyMethod · 0.95
addHeaderMethod · 0.80

Tested by

no test coverage detected