CORE-POS/IS4C

View on GitHub
pos/is4c-nf/plugins/CoopCred/CoopCredLib.php

Summary

Maintainability
D
2 days
Test Coverage

Method programOK has 108 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    static public function programOK($pKey='', $conn='') 
    {
        global $CORE_LOCAL;

        if (!$CORE_LOCAL->get("memberID")) {
Severity: Major
Found in pos/is4c-nf/plugins/CoopCred/CoopCredLib.php - About 4 hrs to fix

    Function programOK has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        static public function programOK($pKey='', $conn='') 
        {
            global $CORE_LOCAL;
    
            if (!$CORE_LOCAL->get("memberID")) {
    Severity: Minor
    Found in pos/is4c-nf/plugins/CoopCred/CoopCredLib.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 getCCredSubtotals has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        static public function getCCredSubtotals($tender, $conn,
            $programCode='', $table='', $ref='') 
        {
            global $CORE_LOCAL;
    
    
    Severity: Major
    Found in pos/is4c-nf/plugins/CoopCred/CoopCredLib.php - About 2 hrs to fix

      Function getCCredSubtotals has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          static public function getCCredSubtotals($tender, $conn,
              $programCode='', $table='', $ref='') 
          {
              global $CORE_LOCAL;
      
      
      Severity: Minor
      Found in pos/is4c-nf/plugins/CoopCred/CoopCredLib.php - About 55 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

      Method getCCredSubtotals has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          static public function getCCredSubtotals($tender, $conn,
              $programCode='', $table='', $ref='') 
      Severity: Minor
      Found in pos/is4c-nf/plugins/CoopCred/CoopCredLib.php - About 35 mins to fix

        Avoid too many return statements within this method.
        Open

                    return _("Member ") .
                        $CORE_LOCAL->get("memberID") .
                        _(" is not registered for ") .
                        $CORE_LOCAL->get("{$programCode}programName") .
                        ".";
        Severity: Major
        Found in pos/is4c-nf/plugins/CoopCred/CoopCredLib.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return _("Member #") .
                          $CORE_LOCAL->get("memberID") .
                          _(" may not transfer Coop Cred to another Member") .
                          ".";
          Severity: Major
          Found in pos/is4c-nf/plugins/CoopCred/CoopCredLib.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return _("Member #") .
                            $CORE_LOCAL->get("memberID") .
                            _(" may not pay into ") .
                            $CORE_LOCAL->get("{$programCode}programName") .
                            ".";
            Severity: Major
            Found in pos/is4c-nf/plugins/CoopCred/CoopCredLib.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return True;
              Severity: Major
              Found in pos/is4c-nf/plugins/CoopCred/CoopCredLib.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return $pgm->programName() . _(" hasn't started yet.");
                Severity: Major
                Found in pos/is4c-nf/plugins/CoopCred/CoopCredLib.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return $pgm->programName() . _(" is no longer operating.");
                  Severity: Major
                  Found in pos/is4c-nf/plugins/CoopCred/CoopCredLib.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return "Error: execute() failed for query: $query args:" .
                                        implode('|',$args);
                    Severity: Major
                    Found in pos/is4c-nf/plugins/CoopCred/CoopCredLib.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return _("Member #") .
                                      $CORE_LOCAL->get("memberID") .
                                      _(" is registered for ") .
                                      '<b>'.  $CORE_LOCAL->get("{$programCode}programName"). '</b>' .
                                      _(" but may not use it") .
                      Severity: Major
                      Found in pos/is4c-nf/plugins/CoopCred/CoopCredLib.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return $pgm->programName() . _(" is not accepting purchases at this time.");
                        Severity: Major
                        Found in pos/is4c-nf/plugins/CoopCred/CoopCredLib.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return $pgm->programName() . _(" is not active.");
                          Severity: Major
                          Found in pos/is4c-nf/plugins/CoopCred/CoopCredLib.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                            return "Error: prepare() failed for query: $query";
                            Severity: Major
                            Found in pos/is4c-nf/plugins/CoopCred/CoopCredLib.php - About 30 mins to fix

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

                                  static public function addDepartmentUsed($paymentDepartment=0,$programID=0)
                                  {
                                      global $CORE_LOCAL;
                              
                                      /* I think it could default to using the current ones set by programOK()
                              Severity: Minor
                              Found in pos/is4c-nf/plugins/CoopCred/CoopCredLib.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