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

Method evaluateIfNoneMatch

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

Source from the content-addressed store, hash-verified

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

Callers 2

readMethod · 0.95
readPanoramaMethod · 0.95

Calls 1

getRequestCacheKeyMethod · 0.95

Tested by

no test coverage detected