Skip to content

Commit 6bf63c2

Browse files
committed
Style fixes
1 parent df1b3ef commit 6bf63c2

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

src/CachePlugin.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,17 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
7575
}
7676

7777
// Add headers to ask the server if this cache is still valid
78-
if ($modifiedAt = $this->getModifiedAt($cacheItem)) {
79-
$modifiedAt = new \DateTime('@'.$modifiedAt);
80-
$modifiedAt->setTimezone(new \DateTimeZone('GMT'));
81-
$request = $request->withHeader(
82-
'If-Modified-Since',
83-
sprintf('%s GMT', $modifiedAt->format('l, d-M-y H:i:s'))
84-
);
78+
if ($mod = $this->getModifiedAt($cacheItem)) {
79+
$mod = new \DateTime('@'.$mod);
80+
$mod->setTimezone(new \DateTimeZone('GMT'));
81+
$request = $request->withHeader('If-Modified-Since', sprintf('%s GMT', $mod->format('l, d-M-y H:i:s')));
8582
}
8683

8784
if ($etag = $this->getETag($cacheItem)) {
88-
$request = $request->withHeader(
89-
'If-None-Match',
90-
$etag
91-
);
85+
$request = $request->withHeader('If-None-Match', $etag);
9286
}
9387
}
9488

95-
9689
return $next($request)->then(function (ResponseInterface $response) use ($cacheItem) {
9790
if (304 === $response->getStatusCode()) {
9891
if (!$cacheItem->isHit()) {

0 commit comments

Comments
 (0)