Code Duplication    Length = 21-23 lines in 2 locations

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

@@ 386-406 (lines=21) @@
383
     * @return Response
384
     * @Route("/dbQueries1/{days}", name="support_db_queries_1")
385
     */
386
    public function executeSQL_caches_old_reg_date(int $days = 31) // List caches from users whose registration date is not older than x days.
387
    : Response
388
    {
389
        $formSearch = $this->createForm(SupportSearchCaches::class);
390
391
        $qb = $this->connection->createQueryBuilder();
392
        $qb->select('caches.name', 'user.username', 'user.date_created', 'user.last_login')
393
            ->from('caches')
394
            ->innerJoin('caches', 'user', 'user', 'caches.user_id = user.user_id')
395
            ->where('user.date_created > now() - interval :searchTerm DAY')
396
            ->andWhere('caches.user_id = user.user_id')
397
            ->setParameters(['searchTerm' => $days])
398
            ->orderBy('date_created', 'DESC');
399
400
        return $this->render(
401
            'backend/support/databaseQueries.html.twig', [
402
                                                           'supportCachesForm' => $formSearch->createView(),
403
                                                           'suppSQLquery1' => $qb->execute()->fetchAll()
404
                                                       ]
405
        );
406
    }
407
408
    /**
409
     * @param int $days
@@ 438-460 (lines=23) @@
435
     * @return Response
436
     * @Route("/dbQueries4", name="support_db_queries_4")
437
     */
438
    public function executeSQL_caches_old_login_date(
439
    ) // List (non-archived, non-locked) caches from users whose last login date is older than one year.
440
    : Response
441
    {
442
        $formSearch = $this->createForm(SupportSearchCaches::class);
443
444
        $qb = $this->connection->createQueryBuilder();
445
        $qb->select('caches.name', 'caches.cache_id', 'caches.status', 'user.username', 'user.last_login')
446
            ->from('caches')
447
            ->innerJoin('caches', 'user', 'user', 'caches.user_id = user.user_id')
448
            ->where('user.last_login < now() - interval :searchTerm YEAR')
449
            ->andWhere('caches.status <= 2')
450
            ->andWhere(('caches.user_id = user.user_id'))
451
            ->setParameters(['searchTerm' => 1])
452
            ->orderBy('user.last_login', 'ASC');
453
454
        return $this->render(
455
            'backend/support/databaseQueries.html.twig', [
456
                                                           'supportCachesForm' => $formSearch->createView(),
457
                                                           'suppSQLquery4' => $qb->execute()->fetchAll()
458
                                                       ]
459
        );
460
    }
461
462
    /**
463
     * @param string $what