Code Duplication    Length = 4-4 lines in 7 locations

src/AppBundle/Controller/TopEditsController.php 1 location

@@ 101-104 (lines=4) @@
98
    {
99
        $projectData = ProjectRepository::getProject($project, $this->container);
100
101
        if (!$projectData->exists()) {
102
            $this->addFlash("notice", ["invalid-project", $project]);
103
            return $this->redirectToRoute("topedits");
104
        }
105
106
        $user = UserRepository::getUser($username, $this->container);
107

src/AppBundle/Controller/AdminScoreController.php 1 location

@@ 84-87 (lines=4) @@
81
        $projectData = ProjectRepository::getProject($project, $this->container);
82
        $projectRepo = $projectData->getRepository();
83
84
        if (!$projectData->exists()) {
85
            $this->addFlash("notice", ["invalid-project", $project]);
86
            return $this->redirectToRoute("adminscore");
87
        }
88
89
        $dbName = $projectData->getDatabaseName();
90

src/AppBundle/Controller/AdminStatsController.php 1 location

@@ 148-151 (lines=4) @@
145
        $projectData = ProjectRepository::getProject($project, $this->container);
146
        $projectRepo = $projectData->getRepository();
147
148
        if (!$projectData->exists()) {
149
            $this->addFlash('notice', ['invalid-project', $project]);
150
            return $this->redirectToRoute('adminstats');
151
        }
152
153
        $dbName = $projectData->getDatabaseName();
154

src/AppBundle/Controller/PagesController.php 1 location

@@ 122-125 (lines=4) @@
119
        $projectRepo = $projectData->getRepository();
120
121
        // If the project exists, actually populate the values
122
        if (!$projectData->exists()) {
123
            $this->addFlash('notice', ['invalid-project', $project]);
124
            return $this->redirectToRoute('pages');
125
        }
126
        if (!$user->existsOnProject($projectData)) {
127
            $this->addFlash('notice', ['user-not-found']);
128
            return $this->redirectToRoute('pages');

src/AppBundle/Controller/AutomatedEditsController.php 1 location

@@ 116-119 (lines=4) @@
113
        // Pull information about the project
114
        $projectData = ProjectRepository::getProject($project, $this->container);
115
116
        if (!$projectData->exists()) {
117
            $this->addFlash('notice', ['invalid-project', $project]);
118
            return $this->redirectToRoute('autoedits');
119
        }
120
121
        // Validating the dates. If the dates are invalid, we'll redirect
122
        // to the project and username view.

src/AppBundle/Controller/RfXVoteCalculatorController.php 1 location

@@ 105-108 (lines=4) @@
102
103
        $rfxParam = $this->getParameter('rfx');
104
105
        if (!$projectData->exists() || $rfxParam == null) {
106
            $this->addFlash('notice', ['invalid-project', $project]);
107
            return $this->redirectToRoute('rfxvote');
108
        }
109
110
        $namespaces = $projectData->getNamespaces();
111

src/AppBundle/Controller/ArticleInfoController.php 1 location

@@ 167-170 (lines=4) @@
164
        $projectQuery = $request->attributes->get('project');
165
        $project = ProjectRepository::getProject($projectQuery, $this->container);
166
        $this->projectRepo = $project->getRepository();
167
        if (!$project->exists()) {
168
            $this->addFlash('notice', ['invalid-project', $projectQuery]);
169
            return $this->redirectToRoute('articleInfo');
170
        }
171
        $this->dbName = $project->getDatabaseName();
172
173
        $pageQuery = $request->attributes->get('article');