phpmyadmin/phpmyadmin

View on GitHub
src/Database/CentralColumns.php

Summary

Maintainability
F
5 days
Test Coverage

File CentralColumns.php has 641 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

namespace PhpMyAdmin\Database;
Severity: Major
Found in src/Database/CentralColumns.php - About 1 day to fix

    Function makeConsistentWithList has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        public function makeConsistentWithList(
            string $db,
            array $selectedTables,
        ): bool|Message {
            $message = true;
    Severity: Minor
    Found in src/Database/CentralColumns.php - About 4 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 syncUniqueColumns has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        public function syncUniqueColumns(
            DatabaseName $databaseName,
            array $fieldSelect,
            bool $isTable = true,
            string $containingTable = '',
    Severity: Minor
    Found in src/Database/CentralColumns.php - About 3 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 deleteColumnsFromList has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        public function deleteColumnsFromList(
            string $database,
            array $fieldSelect,
            bool $isTable = true,
        ): bool|Message {
    Severity: Minor
    Found in src/Database/CentralColumns.php - About 3 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 syncUniqueColumns has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function syncUniqueColumns(
            DatabaseName $databaseName,
            array $fieldSelect,
            bool $isTable = true,
            string $containingTable = '',
    Severity: Major
    Found in src/Database/CentralColumns.php - About 2 hrs to fix

      Method getTemplateVariablesForMain has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getTemplateVariablesForMain(
              string $db,
              int $totalRows,
              int $pos,
              string $textDir,
      Severity: Major
      Found in src/Database/CentralColumns.php - About 2 hrs to fix

        Method deleteColumnsFromList has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function deleteColumnsFromList(
                string $database,
                array $fieldSelect,
                bool $isTable = true,
            ): bool|Message {
        Severity: Major
        Found in src/Database/CentralColumns.php - About 2 hrs to fix

          CentralColumns has 21 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class CentralColumns
          {
              /**
               * Current user
               */
          Severity: Minor
          Found in src/Database/CentralColumns.php - About 2 hrs to fix

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

                public function getTemplateVariablesForMain(
                    string $db,
                    int $totalRows,
                    int $pos,
                    string $textDir,
            Severity: Minor
            Found in src/Database/CentralColumns.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 makeConsistentWithList has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function makeConsistentWithList(
                    string $db,
                    array $selectedTables,
                ): bool|Message {
                    $message = true;
            Severity: Minor
            Found in src/Database/CentralColumns.php - About 1 hr to fix

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

                  public function updateOneColumn(
                      string $db,
                      string $origColName,
                      string $colName,
                      string $colType,
              Severity: Minor
              Found in src/Database/CentralColumns.php - About 1 hr to fix

                Method getHtmlForEditTableRow has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function getHtmlForEditTableRow(array $row, int $rowNum): string
                    {
                        $meta = [];
                        if (! isset($row['col_default']) || $row['col_default'] == '') {
                            $meta['DefaultType'] = 'NONE';
                Severity: Minor
                Found in src/Database/CentralColumns.php - About 1 hr to fix

                  Method updateOneColumn has 10 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          string $db,
                          string $origColName,
                          string $colName,
                          string $colType,
                          string $colAttribute,
                  Severity: Major
                  Found in src/Database/CentralColumns.php - About 1 hr to fix

                    Method updateMultipleColumn has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function updateMultipleColumn(array $params): bool|Message
                        {
                            $columnDefault = $params['field_default_type'];
                            $columnIsNull = [];
                            $columnExtra = [];
                    Severity: Minor
                    Found in src/Database/CentralColumns.php - About 1 hr to fix

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

                          private function getHtmlForEditTableRow(array $row, int $rowNum): string
                          {
                              $meta = [];
                              if (! isset($row['col_default']) || $row['col_default'] == '') {
                                  $meta['DefaultType'] = 'NONE';
                      Severity: Minor
                      Found in src/Database/CentralColumns.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

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

                          private function handleColumnExtra(array &$columnsList): void
                          {
                              foreach ($columnsList as &$row) {
                                  $vals = explode(',', $row['col_extra']);
                      
                      
                      Severity: Minor
                      Found in src/Database/CentralColumns.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 updateMultipleColumn has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function updateMultipleColumn(array $params): bool|Message
                          {
                              $columnDefault = $params['field_default_type'];
                              $columnIsNull = [];
                              $columnExtra = [];
                      Severity: Minor
                      Found in src/Database/CentralColumns.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