Skip to content

Commit 33c6e1c

Browse files
committed
Style fixes
1 parent 39c0cfe commit 33c6e1c

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
@@ -76,24 +76,17 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
7676
}
7777

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

8885
if ($etag = $this->getETag($cacheItem)) {
89-
$request = $request->withHeader(
90-
'If-None-Match',
91-
$etag
92-
);
86+
$request = $request->withHeader('If-None-Match', $etag);
9387
}
9488
}
9589

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

0 commit comments

Comments
 (0)