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 = 82-89 lines in 2 locations

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

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

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

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