Code Duplication    Length = 5-5 lines in 2 locations

src/CacheMiddleware.php 2 locations

@@ 226-230 (lines=5) @@
223
                         * @var string $headerName
224
                         * @var string[] $headerValue
225
                         */
226
                        foreach ($cacheEntry->getOriginalResponse()->getHeaders() as $headerName => $headerValue) {
227
                            if (!$response->hasHeader($headerName) && $headerName !== self::HEADER_CACHE_INFO) {
228
                                $response = $response->withHeader($headerName, $headerValue);
229
                            }
230
                        }
231
232
                        $update = true;
233
                    } else {
@@ 310-314 (lines=5) @@
307
                        $response = $response->withBody($cacheEntry->getResponse()->getBody());
308
309
                        // Merge headers of the "304 Not Modified" and the cache entry
310
                        foreach ($cacheEntry->getResponse()->getHeaders() as $headerName => $headerValue) {
311
                            if (!$response->hasHeader($headerName)) {
312
                                $response = $response->withHeader($headerName, $headerValue);
313
                            }
314
                        }
315
316
                        $update = true;
317
                    }