Code Duplication    Length = 7-9 lines in 2 locations

src/Controller/DefaultController.php 2 locations

@@ 19-27 (lines=9) @@
16
17
    public function loginAction(Request $request)
18
    {
19
        if (!$this->isGranted('ROLE_USER')) {
20
            if ($request->hasSession() && $request->isMethodSafe()) {
21
                $referer = $request->headers->get('referer');
22
                if (null !== $referer) {
23
                    $request->getSession()->set('ddr.gitki.manuallogin.targetpath', $referer);
24
                }
25
            }
26
            throw new AuthenticationException();
27
        }
28
29
        if ($request->hasSession() && $request->isMethodSafe()) {
30
            $targetPath = $request->getSession()->get('ddr.gitki.manuallogin.targetpath');
@@ 29-35 (lines=7) @@
26
            throw new AuthenticationException();
27
        }
28
29
        if ($request->hasSession() && $request->isMethodSafe()) {
30
            $targetPath = $request->getSession()->get('ddr.gitki.manuallogin.targetpath');
31
            $request->getSession()->remove('ddr.gitki.manuallogin.targetpath');
32
            if (null !== $targetPath) {
33
                return $this->redirect($targetPath);
34
            }
35
        }
36
37
        return $this->redirect($this->generateUrl('ddr_gitki_directory', ['path' => '/', 'action' => 'index']));
38
    }