Code Duplication    Length = 9-12 lines in 2 locations

src/Controller/DefaultController.php 2 locations

@@ 19-30 (lines=12) @@
16
17
    public function loginAction(Request $request)
18
    {
19
        if (!$this->isGranted('ROLE_USER')) {
20
21
            /* Save targetpath if user was not logged in yet before redirecting to login page */
22
            if ($request->hasSession() && $request->isMethodSafe(false)) {
23
                $referer = $request->headers->get('referer');
24
                if (null !== $referer) {
25
                    $request->getSession()->set('ddr.gitki.manuallogin.targetpath', $referer);
26
                }
27
            }
28
29
            throw new AuthenticationException();
30
        }
31
32
        if ($request->hasSession() && $request->isMethodSafe(false)) {
33
@@ 32-40 (lines=9) @@
29
            throw new AuthenticationException();
30
        }
31
32
        if ($request->hasSession() && $request->isMethodSafe(false)) {
33
34
            /* Restore target path after login */
35
            $targetPath = $request->getSession()->get('ddr.gitki.manuallogin.targetpath');
36
            $request->getSession()->remove('ddr.gitki.manuallogin.targetpath');
37
            if (null !== $targetPath) {
38
                return $this->redirect($targetPath);
39
            }
40
        }
41
42
        return $this->redirect($this->generateUrl('ddr_gitki_directory', ['path' => '/', 'action' => 'index']));
43
    }