Code Duplication    Length = 8-8 lines in 2 locations

src/Lodash/Middlewares/AllowCorsRequests.php 2 locations

@@ 38-45 (lines=8) @@
35
36
        $origin = $request->headers->get('Origin', '');
37
        $host = $this->parseUrl($origin);
38
        if (empty($host)) {
39
            $this->logRequest('Origin is invalid', [
40
                'origin' => $origin,
41
                'parsed' => $host,
42
            ]);
43
44
            return $this->response($request, 'Origin is invalid', Response::HTTP_BAD_REQUEST);
45
        }
46
47
        $allowedOrigins = config('lodash.cors.allow_origins', []);
48
        $currentApp = $this->parseUrl((string) config('app.url', ''));
@@ 61-68 (lines=8) @@
58
            }
59
        }
60
61
        if (! $found) {
62
            $this->logRequest('Origin is not allowed', [
63
                'origin' => $origin,
64
                'parsed' => $host,
65
            ]);
66
67
            return $this->response($request, 'Origin is not allowed', Response::HTTP_METHOD_NOT_ALLOWED);
68
        }
69
70
        if ($request->method() === Request::METHOD_OPTIONS) {
71
            $allowedHeaders = config('lodash.cors.allow_headers', []);