Code Duplication    Length = 15-15 lines in 3 locations

src/controllers/RolesController.php 3 locations

@@ 399-413 (lines=15) @@
396
        $_POST['formPassword']  = '';
397
    }
398
399
    private function _populateMemberof($data)
400
    {
401
        if (!isset($_POST['memberof'])) {
402
            $memberof = $data->getMemberOf($_REQUEST['rolename']);
403
            if ($memberof->recordCount() > 0) {
404
                $i = 0;
405
                while (!$memberof->EOF) {
406
                    $_POST['memberof'][$i++] = $memberof->fields['rolname'];
407
                    $memberof->moveNext();
408
                }
409
            } else {
410
                $_POST['memberof'] = [];
411
            }
412
        }
413
    }
414
415
    private function _populateMembers($data)
416
    {
@@ 415-429 (lines=15) @@
412
        }
413
    }
414
415
    private function _populateMembers($data)
416
    {
417
        if (!isset($_POST['members'])) {
418
            $members = $data->getMembers($_REQUEST['rolename']);
419
            if ($members->recordCount() > 0) {
420
                $i = 0;
421
                while (!$members->EOF) {
422
                    $_POST['members'][$i++] = $members->fields['rolname'];
423
                    $members->moveNext();
424
                }
425
            } else {
426
                $_POST['members'] = [];
427
            }
428
        }
429
    }
430
431
    private function _populateAdminmembers($data)
432
    {
@@ 431-445 (lines=15) @@
428
        }
429
    }
430
431
    private function _populateAdminmembers($data)
432
    {
433
        if (!isset($_POST['adminmembers'])) {
434
            $adminmembers = $data->getMembers($_REQUEST['rolename'], 't');
435
            if ($adminmembers->recordCount() > 0) {
436
                $i = 0;
437
                while (!$adminmembers->EOF) {
438
                    $_POST['adminmembers'][$i++] = $adminmembers->fields['rolname'];
439
                    $adminmembers->moveNext();
440
                }
441
            } else {
442
                $_POST['adminmembers'] = [];
443
            }
444
        }
445
    }
446
447
    /**
448
     * Function to allow alter a role.