Code Duplication    Length = 4-4 lines in 7 locations

src/AppBundle/Controller/TopEditsController.php 1 location

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

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/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/AutomatedEditsController.php 1 location

@@ 127-130 (lines=4) @@
124
        // Pull information about the project
125
        $projectData = ProjectRepository::getProject($project, $this->container);
126
127
        if (!$projectData->exists()) {
128
            $this->addFlash('notice', ['invalid-project', $project]);
129
            return $this->redirectToRoute('autoedits');
130
        }
131
132
        // Validating the dates. If the dates are invalid, we'll redirect
133
        // to the project and username view.

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');