Code Duplication    Length = 10-13 lines in 4 locations

app/src/Users/UsersController.php 4 locations

@@ 57-66 (lines=10) @@
54
     *
55
     * @return void
56
     */
57
    public function acronymAction($acronym = null)
58
    {
59
        $user = $this->users->query()
60
        ->where('acronym = ' . "'$acronym'")
61
        ->execute()[0];
62
        $this->theme->setTitle("View user with acronym");
63
        $this->views->add('users/view', [
64
            'user' => $user,
65
        ]);
66
    }
67
    /**
68
     * List user with id.
69
     *
@@ 411-423 (lines=13) @@
408
     *
409
     * @return void
410
     */
411
    public function activeAction()
412
    {
413
        $all = $this->users->query()
414
            ->where('active IS NOT NULL')
415
            ->andWhere('deleted is NULL')
416
            ->execute();
417
418
        $this->theme->setTitle("Users that are active");
419
        $this->views->add('users/list-all', [
420
            'users' => $all,
421
            'title' => "Users that are active",
422
        ]);
423
    }
424
    /**
425
     * List all inactive and not deleted users.
426
     *
@@ 429-441 (lines=13) @@
426
     *
427
     * @return void
428
     */
429
    public function inactiveAction()
430
    {
431
        $all = $this->users->query()
432
            ->where('active IS NULL')
433
            ->andWhere('deleted is NULL')
434
            ->execute();
435
436
        $this->theme->setTitle("Users that are inactive");
437
        $this->views->add('users/list-all', [
438
            'users' => $all,
439
            'title' => "Users that are inactive",
440
        ]);
441
    }
442
    /**
443
     * List all active and not deleted users.
444
     *
@@ 447-458 (lines=12) @@
444
     *
445
     * @return void
446
     */
447
    public function wastebasketAction()
448
    {
449
        $all = $this->users->query()
450
            ->where('deleted is NOT NULL')
451
            ->execute();
452
453
        $this->theme->setTitle("Users that are in wastebasket");
454
        $this->views->add('users/list-all', [
455
            'users' => $all,
456
            'title' => "Users that are in wastebasket",
457
        ]);
458
    }
459
}
460