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

Method evaluateIfNoneMatch

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

Source from the content-addressed store, hash-verified

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');

Callers 2

readMethod · 0.95
readPanoramaMethod · 0.95

Calls 1

getRequestCacheKeyMethod · 0.95

Tested by

no test coverage detected