Code Duplication    Length = 4-4 lines in 7 locations

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/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

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

src/AppBundle/Controller/RfXVoteCalculatorController.php 1 location

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

src/AppBundle/Controller/AdminStatsController.php 1 location

@@ 154-157 (lines=4) @@
151
        $projectData = ProjectRepository::getProject($project, $this->container);
152
        $projectRepo = $projectData->getRepository();
153
154
        if (!$projectData->exists()) {
155
            $this->addFlash('notice', ['invalid-project', $project]);
156
            return $this->redirectToRoute('adminstats');
157
        }
158
159
        $dbName = $projectData->getDatabaseName();
160

src/AppBundle/Controller/ArticleInfoController.php 1 location

@@ 134-137 (lines=4) @@
131
        $projectQuery = $request->attributes->get('project');
132
        $project = ProjectRepository::getProject($projectQuery, $this->container);
133
        $this->projectRepo = $project->getRepository();
134
        if (!$project->exists()) {
135
            $this->addFlash('notice', ['invalid-project', $projectQuery]);
136
            return $this->redirectToRoute('articleInfo');
137
        }
138
        $this->dbName = $project->getDatabaseName();
139
140
        $pageQuery = $request->attributes->get('article');

src/AppBundle/Controller/TopEditsController.php 1 location

@@ 116-119 (lines=4) @@
113
    {
114
        $projectData = ProjectRepository::getProject($project, $this->container);
115
116
        if (!$projectData->exists()) {
117
            $this->addFlash('notice', ['invalid-project', $project]);
118
            return $this->redirectToRoute('topedits');
119
        }
120
121
        $user = UserRepository::getUser($username, $this->container);
122