Admidio/admidio

View on GitHub
adm_program/system/classes/TableMembers.php

Summary

Maintainability
C
7 hrs
Test Coverage

Function startMembership has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function startMembership(int $roleId = 0, int $userId = 0, bool $leader = null, int $approvalState = null): bool
    {
        global $gCurrentUser, $gCurrentUserId;

        // if role and user is set, then search for this membership and load data into class
Severity: Minor
Found in adm_program/system/classes/TableMembers.php - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method save has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function save(bool $updateFingerPrint = true): bool
    {
        global $gCurrentSession, $gChangeNotification, $gCurrentUser;

        // if role is administrator than only administrator can add new user,
Severity: Minor
Found in adm_program/system/classes/TableMembers.php - About 1 hr to fix

    Method delete has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function delete(): bool
        {
            // Queue admin notification about membership deletion
            global $gChangeNotification, $gCurrentSession;
    
    
    Severity: Minor
    Found in adm_program/system/classes/TableMembers.php - About 1 hr to fix

      Method startMembership has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function startMembership(int $roleId = 0, int $userId = 0, bool $leader = null, int $approvalState = null): bool
          {
              global $gCurrentUser, $gCurrentUserId;
      
              // if role and user is set, then search for this membership and load data into class
      Severity: Minor
      Found in adm_program/system/classes/TableMembers.php - About 1 hr to fix

        Function setValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function setValue(string $columnName, $newValue, bool $checkValue = true): bool
            {
                global $gChangeNotification, $gCurrentSession;
        
                // New records will be logged in ::save, because their ID is only generated during first save
        Severity: Minor
        Found in adm_program/system/classes/TableMembers.php - About 35 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function save(bool $updateFingerPrint = true): bool
            {
                global $gCurrentSession, $gChangeNotification, $gCurrentUser;
        
                // if role is administrator than only administrator can add new user,
        Severity: Minor
        Found in adm_program/system/classes/TableMembers.php - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        There are no issues that match your filters.

        Category
        Status