Code Duplication    Length = 14-16 lines in 2 locations

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

@@ 166-179 (lines=14) @@
163
     * @return Response
164
     * @Route("/dbQueries1/{days}", name="support_db_queries_1")
165
     */
166
    public function executeSQL_caches_old_reg_date(int $days = 31) // List caches from users whose registration date is not older than x days.
167
    : Response
168
    {
169
        $qb = $this->connection->createQueryBuilder();
170
        $qb->select('caches.name', 'user.username', 'user.date_created', 'user.last_login')
171
            ->from('caches')
172
            ->innerJoin('caches', 'user', 'user', 'caches.user_id = user.user_id')
173
            ->where('user.date_created > now() - interval :searchTerm DAY')
174
            ->andWhere('caches.user_id = user.user_id')
175
            ->setParameters(['searchTerm' => $days])
176
            ->orderBy('date_created', 'DESC');
177
178
        return $this->render('backend/support/databaseQueries.html.twig', ['suppSQLquery1' => $qb->execute()->fetchAll()]);
179
    }
180
181
    /**
182
     * @param int $days
@@ 204-219 (lines=16) @@
201
     * @return Response
202
     * @Route("/dbQueries4", name="support_db_queries_4")
203
     */
204
    public function executeSQL_caches_old_login_date(
205
    ) // List (non-archived, non-locked) caches from users whose last login date is older than one year.
206
    : Response
207
    {
208
        $qb = $this->connection->createQueryBuilder();
209
        $qb->select('caches.name', 'caches.cache_id', 'caches.status', 'user.username', 'user.last_login')
210
            ->from('caches')
211
            ->innerJoin('caches', 'user', 'user', 'caches.user_id = user.user_id')
212
            ->where('user.last_login < now() - interval :searchTerm YEAR')
213
            ->andWhere('caches.status <= 2')
214
            ->andWhere(('caches.user_id = user.user_id'))
215
            ->setParameters(['searchTerm' => 1])
216
            ->orderBy('user.last_login', 'ASC');
217
218
        return $this->render('backend/support/databaseQueries.html.twig', ['suppSQLquery4' => $qb->execute()->fetchAll()]);
219
    }
220
221
    /**
222
     * @param string $what