Code Duplication    Length = 5-5 lines in 2 locations

src/CacheMiddleware.php 2 locations

@@ 214-218 (lines=5) @@
211
                         * @var string $headerName
212
                         * @var string[] $headerValue
213
                         */
214
                        foreach ($cacheEntry->getOriginalResponse()->getHeaders() as $headerName => $headerValue) {
215
                            if (!$response->hasHeader($headerName) && $headerName !== self::HEADER_CACHE_INFO) {
216
                                $response = $response->withHeader($headerName, $headerValue);
217
                            }
218
                        }
219
220
                        $update = true;
221
                    } else {
@@ 298-302 (lines=5) @@
295
                        $response = $response->withBody($cacheEntry->getResponse()->getBody());
296
297
                        // Merge headers of the "304 Not Modified" and the cache entry
298
                        foreach ($cacheEntry->getResponse()->getHeaders() as $headerName => $headerValue) {
299
                            if (!$response->hasHeader($headerName)) {
300
                                $response = $response->withHeader($headerName, $headerValue);
301
                            }
302
                        }
303
304
                        $update = true;
305
                    }