GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Code Duplication    Length = 86-90 lines in 2 locations

src/Application/Controller/MembersArea/PostsController.php 1 location

@@ 215-304 (lines=90) @@
212
     *
213
     * @return Response
214
     */
215
    public function removeAction($id, Request $request, Application $app)
216
    {
217
        if (
218
            !$app['security']->isGranted('ROLE_POSTS_EDITOR') &&
219
            !$app['security']->isGranted('ROLE_ADMIN')
220
        ) {
221
            $app->abort(403);
222
        }
223
224
        $posts = array();
225
        $ids = $request->query->get('ids', false);
226
        $idsExploded = explode(',', $ids);
227
        foreach ($idsExploded as $singleId) {
228
            $singleEntity = $app['orm.em']->find(
229
                'Application\Entity\PostEntity',
230
                $singleId
231
            );
232
233
            if ($singleEntity) {
234
                $posts[] = $singleEntity;
235
            }
236
        }
237
238
        $post = $app['orm.em']->find('Application\Entity\PostEntity', $id);
239
240
        if (
241
            (
242
                !$post &&
243
                $ids === false
244
            ) ||
245
            (
246
                empty($posts) &&
247
                $ids !== false
248
            )
249
        ) {
250
            $app->abort(404);
251
        }
252
253
        $confirmAction = $app['request']->query->has('action') &&
254
            $app['request']->query->get('action') == 'confirm'
255
        ;
256
257
        if ($confirmAction) {
258
            try {
259
                if (!empty($posts)) {
260
                    foreach ($posts as $post) {
261
                        $app['orm.em']->remove($post);
262
                    }
263
                } else {
264
                    $app['orm.em']->remove($post);
265
                }
266
267
                $app['orm.em']->flush();
268
269
                $app['flashbag']->add(
270
                    'success',
271
                    $app['translator']->trans(
272
                        'The post "%post%" was successfully removed!',
273
                        array(
274
                            '%post%' => $post,
275
                        )
276
                    )
277
                );
278
            } catch (\Exception $e) {
279
                $app['flashbag']->add(
280
                    'danger',
281
                    $app['translator']->trans(
282
                        $e->getMessage()
283
                    )
284
                );
285
            }
286
287
            return $app->redirect(
288
                $app['url_generator']->generate(
289
                    'members-area.posts'
290
                )
291
            );
292
        }
293
294
        return new Response(
295
            $app['twig']->render(
296
                'contents/members-area/posts/remove.html.twig',
297
                array(
298
                    'post' => $post,
299
                    'posts' => $posts,
300
                    'ids' => $ids,
301
                )
302
            )
303
        );
304
    }
305
}
306

src/Application/Controller/MembersArea/UsersController.php 1 location

@@ 273-358 (lines=86) @@
270
        );
271
    }
272
273
    public function removeAction($id, Request $request, Application $app)
274
    {
275
        if (
276
            !$app['security']->isGranted('ROLE_USERS_EDITOR') &&
277
            !$app['security']->isGranted('ROLE_ADMIN')
278
        ) {
279
            $app->abort(403);
280
        }
281
282
        $users = array();
283
        $ids = $request->query->get('ids', false);
284
        $idsExploded = explode(',', $ids);
285
        foreach ($idsExploded as $singleId) {
286
            $singleEntity = $app['orm.em']->find(
287
                'Application\Entity\UserEntity',
288
                $singleId
289
            );
290
291
            if ($singleEntity) {
292
                $users[] = $singleEntity;
293
            }
294
        }
295
296
        $user = $app['orm.em']->find('Application\Entity\UserEntity', $id);
297
298
        if (
299
            (
300
                !$user &&
301
                $ids === false
302
            ) ||
303
            (
304
                empty($users) &&
305
                $ids !== false
306
            )
307
        ) {
308
            $app->abort(404);
309
        }
310
311
        $confirmAction = $app['request']->query->has('action') && $app['request']->query->get('action') == 'confirm';
312
313
        if ($confirmAction) {
314
            try {
315
                if (!empty($users)) {
316
                    foreach ($users as $user) {
317
                        $app['orm.em']->remove($user);
318
                    }
319
                } else {
320
                    $app['orm.em']->remove($user);
321
                }
322
323
                $app['orm.em']->flush();
324
325
                $app['flashbag']->add(
326
                    'success',
327
                    $app['translator']->trans(
328
                        'The user "%user%" was successfully removed!',
329
                        array(
330
                            '%user%' => $user,
331
                        )
332
                    )
333
                );
334
            } catch (\Exception $e) {
335
                $app['flashbag']->add(
336
                    'danger',
337
                    $app['translator']->trans(
338
                        $e->getMessage()
339
                    )
340
                );
341
            }
342
343
            return $app->redirect(
344
                $app['url_generator']->generate('members-area.users')
345
            );
346
        }
347
348
        return new Response(
349
            $app['twig']->render(
350
                'contents/members-area/users/remove.html.twig',
351
                array(
352
                    'user' => $user,
353
                    'users' => $users,
354
                    'ids' => $ids,
355
                )
356
            )
357
        );
358
    }
359
}
360