Code Duplication    Length = 18-23 lines in 5 locations

src/AppBundle/Controller/AdminScoreController.php 1 location

@@ 44-62 (lines=19) @@
41
     * @param Request $request The HTTP request.
42
     * @return Response
43
     */
44
    public function indexAction(Request $request)
45
    {
46
        $params = $this->parseQueryParams($request);
47
48
        // Redirect if we have a project and user.
49
        if (isset($params['project']) && isset($params['username'])) {
50
            return $this->redirectToRoute('AdminScoreResult', $params);
51
        }
52
53
        // Convert the given project (or default project) into a Project instance.
54
        $params['project'] = $this->getProjectFromQuery($params);
55
56
        return $this->render('adminscore/index.html.twig', [
57
            'xtPage' => 'adminscore',
58
            'xtPageTitle' => 'tool-adminscore',
59
            'xtSubtitle' => 'tool-adminscore-desc',
60
            'project' => $params['project'],
61
        ]);
62
    }
63
64
    /**
65
     * Display the AdminScore results.

src/AppBundle/Controller/TopEditsController.php 1 location

@@ 46-67 (lines=22) @@
43
     * @param Request $request
44
     * @return Response
45
     */
46
    public function indexAction(Request $request)
47
    {
48
        $params = $this->parseQueryParams($request);
49
50
        // Redirect if at minimum project and username are provided.
51
        if (isset($params['project']) && isset($params['username'])) {
52
            return $this->redirectToRoute('TopEditsResults', $params);
53
        }
54
55
        // Convert the given project (or default project) into a Project instance.
56
        $params['project'] = $this->getProjectFromQuery($params);
57
58
        return $this->render('topedits/index.html.twig', array_merge([
59
            'xtPageTitle' => 'tool-topedits',
60
            'xtSubtitle' => 'tool-topedits-desc',
61
            'xtPage' => 'topedits',
62
63
            // Defaults that will get overriden if in $params.
64
            'namespace' => 0,
65
            'article' => '',
66
        ], $params));
67
    }
68
69
    /**
70
     * Display the results.

src/AppBundle/Controller/AutomatedEditsController.php 1 location

@@ 49-71 (lines=23) @@
46
     * @param Request $request The HTTP request.
47
     * @return Response
48
     */
49
    public function indexAction(Request $request)
50
    {
51
        $params = $this->parseQueryParams($request);
52
53
        // Redirect if at minimum project and username are provided.
54
        if (isset($params['project']) && isset($params['username'])) {
55
            return $this->redirectToRoute('autoeditsResult', $params);
56
        }
57
58
        // Convert the given project (or default project) into a Project instance.
59
        $params['project'] = $this->getProjectFromQuery($params);
60
61
        return $this->render('autoEdits/index.html.twig', array_merge([
62
            'xtPageTitle' => 'tool-autoedits',
63
            'xtSubtitle' => 'tool-autoedits-desc',
64
            'xtPage' => 'autoedits',
65
66
            // Defaults that will get overriden if in $params.
67
            'namespace' => 0,
68
            'start' => '',
69
            'end' => '',
70
        ], $params));
71
    }
72
73
    /**
74
     * Display the results.

src/AppBundle/Controller/PagesController.php 1 location

@@ 46-68 (lines=23) @@
43
     * @param Request $request
44
     * @return Response
45
     */
46
    public function indexAction(Request $request)
47
    {
48
        $params = $this->parseQueryParams($request);
49
50
        // Redirect if at minimum project and username are given.
51
        if (isset($params['project']) && isset($params['username'])) {
52
            return $this->redirectToRoute('PagesResult', $params);
53
        }
54
55
        // Convert the given project (or default project) into a Project instance.
56
        $params['project'] = $this->getProjectFromQuery($params);
57
58
        // Otherwise fall through.
59
        return $this->render('pages/index.html.twig', array_merge([
60
            'xtPageTitle' => 'tool-pages',
61
            'xtSubtitle' => 'tool-pages-desc',
62
            'xtPage' => 'pages',
63
64
            // Defaults that will get overriden if in $params.
65
            'namespace' => 0,
66
            'redirects' => 'noredirects',
67
        ], $params));
68
    }
69
70
    /**
71
     * Display the results.

src/AppBundle/Controller/ArticleInfoController.php 1 location

@@ 48-65 (lines=18) @@
45
     * @param Request $request The HTTP request.
46
     * @return Response
47
     */
48
    public function indexAction(Request $request)
49
    {
50
        $params = $this->parseQueryParams($request);
51
52
        if (isset($params['project']) && isset($params['article'])) {
53
            return $this->redirectToRoute('ArticleInfoResult', $params);
54
        }
55
56
        // Convert the given project (or default project) into a Project instance.
57
        $params['project'] = $this->getProjectFromQuery($params);
58
59
        return $this->render('articleInfo/index.html.twig', [
60
            'xtPage' => 'articleinfo',
61
            'xtPageTitle' => 'tool-articleinfo',
62
            'xtSubtitle' => 'tool-articleinfo-desc',
63
            'project' => $params['project'],
64
        ]);
65
    }
66
67
    /**
68
     * Generate ArticleInfo gadget script for use on-wiki. This automatically points the