elabftw/elabftw

View on GitHub
src/models/TeamGroups.php

Summary

Maintainability
C
7 hrs
Test Coverage

File TeamGroups.php has 291 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * @package   Elabftw\Elabftw
 * @author    Nicolas CARPi <nico-git@deltablot.email>
Severity: Minor
Found in src/models/TeamGroups.php - About 3 hrs to fix

    Method updateTeamgroupPermissionsOnDestroy has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function updateTeamgroupPermissionsOnDestroy(string $type): bool
        {
            // the complicated SQL could be avoided if we could use JSON_SEARCH with integers but it only works with strings :(
            // https://bugs.mysql.com/bug.php?id=90085
            // we need to do a detour and convert int to string to get the index of the element that we want to remove
    Severity: Minor
    Found in src/models/TeamGroups.php - About 1 hr to fix

      Method readGroupsWithUsersFromUser has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function readGroupsWithUsersFromUser(): array
          {
              $sql = "SELECT team_groups_of_user.name,
                      teams.name AS team_name,
                      JSON_ARRAYAGG(JSON_OBJECT(
      Severity: Minor
      Found in src/models/TeamGroups.php - About 1 hr to fix

        Method readAll has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function readAll(): array
            {
                $sql = "SELECT team_groups.id,
                        team_groups.name,
                        GROUP_CONCAT(users.userid ORDER BY users.firstname, users.lastname) AS userids,
        Severity: Minor
        Found in src/models/TeamGroups.php - About 1 hr to fix

          There are no issues that match your filters.

          Category
          Status