Code Duplication    Length = 27-49 lines in 2 locations

src/AppBundle/Controller/AutomatedEditsController.php 1 location

@@ 33-81 (lines=49) @@
30
        $endDate = $request->query->get("end");
31
32
        // Redirect if the values are set.
33
        if ($projectQuery != "" && $username != "" && $startDate != "" && $endDate != "") {
34
            // Redirect ot the route fully
35
            return $this->redirectToRoute(
36
                "autoeditsResult",
37
                [
38
                    'project'=>$projectQuery,
39
                    'username'=>$username,
40
                    'start' => $startDate,
41
                    'end' => $endDate,
42
                ]
43
            );
44
        } elseif ($projectQuery != "" && $username != "" && $endDate != "") {
45
            // Redirect if we have the username, enddate and project
46
            return $this->redirectToRoute(
47
                "autoeditsResult",
48
                [
49
                    'project'=>$projectQuery,
50
                    'username'=>$username,
51
                    'end' => $endDate,
52
                ]
53
            );
54
        } elseif ($projectQuery != "" && $username != "" && $startDate != "") {
55
            // Redirect if we have the username, stardate and project
56
            return $this->redirectToRoute(
57
                "autoeditsResult",
58
                [
59
                    'project' => $projectQuery,
60
                    'username'=>$username,
61
                    'start' => $startDate,
62
                ]
63
            );
64
        } elseif ($projectQuery != "" && $username != "") {
65
            // Redirect if we have the username and project
66
            return $this->redirectToRoute(
67
                "autoeditsResult",
68
                [
69
                    'project' => $projectQuery,
70
                    'username'=>$username,
71
                ]
72
            );
73
        } elseif ($projectQuery != "") {
74
            // Redirect if we have the project name
75
            return $this->redirectToRoute(
76
                "autoeditsResult",
77
                [
78
                    'project'=>$projectQuery
79
                ]
80
            );
81
        }
82
83
        // set default wiki so we can populate the namespace selector
84
        if (!$projectQuery) {

src/AppBundle/Controller/PagesController.php 1 location

@@ 34-60 (lines=27) @@
31
        $redirects = $request->query->get('redirects');
32
33
        // if values for required parameters are present, redirect to result action
34
        if ($projectQuery != "" && $username != "" && $namespace != "" && $redirects != "") {
35
            return $this->redirectToRoute("PagesResult", [
36
                'project'=>$projectQuery,
37
                'username' => $username,
38
                'namespace'=>$namespace,
39
                'redirects'=>$redirects,
40
            ]);
41
        } elseif ($projectQuery != "" && $username != "" && $namespace != "") {
42
            return $this->redirectToRoute("PagesResult", [
43
                'project'=>$projectQuery,
44
                'username' => $username,
45
                'namespace'=>$namespace,
46
            ]);
47
        } elseif ($projectQuery != "" && $username != "" && $redirects != "") {
48
            return $this->redirectToRoute("PagesResult", [
49
                'project'=>$projectQuery,
50
                'username' => $username,
51
                'redirects'=>$redirects,
52
            ]);
53
        } elseif ($projectQuery != "" && $username != "") {
54
            return $this->redirectToRoute("PagesResult", [
55
                'project'=>$projectQuery,
56
                'username' => $username,
57
            ]);
58
        } elseif ($projectQuery != "") {
59
            return $this->redirectToRoute("PagesProject", [ 'project'=>$projectQuery ]);
60
        }
61
62
        // set default wiki so we can populate the namespace selector
63
        if (!$project) {