Admidio/admidio

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

Summary

Maintainability
F
1 wk
Test Coverage

File ListConfiguration.php has 655 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
use Admidio\Exception;

/**
 * @brief Class manages the list configuration
Severity: Major
Found in adm_program/system/classes/ListConfiguration.php - About 1 day to fix

    Function getSQL has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getSQL(array $options = array()): string
        {
            global $gL10n, $gProfileFields;
    
            // create array with all options
    Severity: Minor
    Found in adm_program/system/classes/ListConfiguration.php - About 1 day 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 convertColumnContentForOutput has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
    Open

        public function convertColumnContentForOutput(int $columnNumber, string $format, string $content, string $userUuid, bool $setSortValue = true)
        {
            global $gDb, $gProfileFields, $gL10n, $gSettingsManager;
    
            $column = $this->getColumnObject($columnNumber);
    Severity: Minor
    Found in adm_program/system/classes/ListConfiguration.php - About 1 day 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 getSQL has 215 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getSQL(array $options = array()): string
        {
            global $gL10n, $gProfileFields;
    
            // create array with all options
    Severity: Major
    Found in adm_program/system/classes/ListConfiguration.php - About 1 day to fix

      Method convertColumnContentForOutput has 119 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function convertColumnContentForOutput(int $columnNumber, string $format, string $content, string $userUuid, bool $setSortValue = true)
          {
              global $gDb, $gProfileFields, $gL10n, $gSettingsManager;
      
              $column = $this->getColumnObject($columnNumber);
      Severity: Major
      Found in adm_program/system/classes/ListConfiguration.php - About 4 hrs to fix

        Function readColumns has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            public function readColumns()
            {
                global $gCurrentUser, $gProfileFields;
        
                $this->columns = array();
        Severity: Minor
        Found in adm_program/system/classes/ListConfiguration.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

        Function getSearchConditions has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getSearchConditions(): array
            {
                global $gProfileFields;
        
                $arrSearchConditions = array();
        Severity: Minor
        Found in adm_program/system/classes/ListConfiguration.php - About 1 hr 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 getSearchConditions has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getSearchConditions(): array
            {
                global $gProfileFields;
        
                $arrSearchConditions = array();
        Severity: Minor
        Found in adm_program/system/classes/ListConfiguration.php - About 1 hr to fix

          Method getColumnAlignments has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getColumnAlignments(): array
              {
                  global $gProfileFields;
          
                  $arrColumnAlignments = array();
          Severity: Minor
          Found in adm_program/system/classes/ListConfiguration.php - About 1 hr to fix

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

                public function getColumnNames(): array
                {
                    global $gL10n, $gProfileFields;
            
                    $arrColumnNames = array();
            Severity: Minor
            Found in adm_program/system/classes/ListConfiguration.php - About 1 hr to fix

              Function getColumnAlignments has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getColumnAlignments(): array
                  {
                      global $gProfileFields;
              
                      $arrColumnAlignments = array();
              Severity: Minor
              Found in adm_program/system/classes/ListConfiguration.php - About 1 hr 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 readColumns has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function readColumns()
                  {
                      global $gCurrentUser, $gProfileFields;
              
                      $this->columns = array();
              Severity: Minor
              Found in adm_program/system/classes/ListConfiguration.php - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                        if ($usfId > 0 && $usfId === (int)$gProfileFields->getProperty('COUNTRY', 'usf_id')) {
                            $content = $gL10n->getCountryName($content);
                        } elseif ($column->getValue('lsc_special_field') === 'usr_photo') {
                            // show user photo
                            if (in_array($format, array('html', 'print'), true)) {
                Severity: Major
                Found in adm_program/system/classes/ListConfiguration.php - About 1 hr to fix

                  Function removeColumn has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function removeColumn(string $columnNameOrUsfId)
                      {
                          $currentNumber = 1;
                  
                          // check for every column if the number is expected otherwise set new number
                  Severity: Minor
                  Found in adm_program/system/classes/ListConfiguration.php - About 45 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 addColumn has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function addColumn($field, int $number = 0, string $sort = '', string $filter = ''): bool
                      {
                          global $gCurrentUser;
                  
                          if ($number === 0) {
                  Severity: Minor
                  Found in adm_program/system/classes/ListConfiguration.php - About 45 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 convertColumnContentForOutput has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public function convertColumnContentForOutput(int $columnNumber, string $format, string $content, string $userUuid, bool $setSortValue = true)
                  Severity: Minor
                  Found in adm_program/system/classes/ListConfiguration.php - About 35 mins to fix

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

                        public function getColumnNamesSql(): array
                        {
                            global $gProfileFields;
                    
                            if (count($this->columnsSqlNames) === 0) {
                    Severity: Minor
                    Found in adm_program/system/classes/ListConfiguration.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 deleteColumn has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function deleteColumn(int $number, bool $all = false): bool
                        {
                            if ($number > $this->countColumns()) {
                                return false;
                            }
                    Severity: Minor
                    Found in adm_program/system/classes/ListConfiguration.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

                    There are no issues that match your filters.

                    Category
                    Status