Code Duplication    Length = 21-23 lines in 2 locations

htdocs_symfony/src/Controller/Backend/SupportController.php 2 locations

@@ 310-330 (lines=21) @@
307
     * @return Response
308
     * @Route("/dbQueries1/{days}", name="support_db_queries_1")
309
     */
310
    public function executeSQL_caches_old_reg_date(int $days = 31) // List caches from users whose registration date is not older than x days.
311
    : Response
312
    {
313
        $formSearch = $this->createForm(SupportSearchCaches::class);
314
315
        $qb = $this->connection->createQueryBuilder();
316
        $qb->select('caches.name', 'user.username', 'user.date_created', 'user.last_login')
317
            ->from('caches')
318
            ->innerJoin('caches', 'user', 'user', 'caches.user_id = user.user_id')
319
            ->where('user.date_created > now() - interval :searchTerm DAY')
320
            ->andWhere('caches.user_id = user.user_id')
321
            ->setParameters(['searchTerm' => $days])
322
            ->orderBy('date_created', 'DESC');
323
324
        return $this->render(
325
            'backend/support/databaseQueries.html.twig', [
326
                                                           'supportCachesForm' => $formSearch->createView(),
327
                                                           'suppSQLquery1' => $qb->execute()->fetchAll()
328
                                                       ]
329
        );
330
    }
331
332
    /**
333
     * @param int $days
@@ 362-384 (lines=23) @@
359
     * @return Response
360
     * @Route("/dbQueries4", name="support_db_queries_4")
361
     */
362
    public function executeSQL_caches_old_login_date(
363
    ) // List (non-archived, non-locked) caches from users whose last login date is older than one year.
364
    : Response
365
    {
366
        $formSearch = $this->createForm(SupportSearchCaches::class);
367
368
        $qb = $this->connection->createQueryBuilder();
369
        $qb->select('caches.name', 'caches.cache_id', 'caches.status', 'user.username', 'user.last_login')
370
            ->from('caches')
371
            ->innerJoin('caches', 'user', 'user', 'caches.user_id = user.user_id')
372
            ->where('user.last_login < now() - interval :searchTerm YEAR')
373
            ->andWhere('caches.status <= 2')
374
            ->andWhere(('caches.user_id = user.user_id'))
375
            ->setParameters(['searchTerm' => 1])
376
            ->orderBy('user.last_login', 'ASC');
377
378
        return $this->render(
379
            'backend/support/databaseQueries.html.twig', [
380
                                                           'supportCachesForm' => $formSearch->createView(),
381
                                                           'suppSQLquery4' => $qb->execute()->fetchAll()
382
                                                       ]
383
        );
384
    }
385
386
    /**
387
     * @param string $what