phpmyadmin/phpmyadmin

View on GitHub
src/Table/Search.php

Summary

Maintainability
D
1 day
Test Coverage

Function getWhereClause has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    private function getWhereClause(
        mixed $criteriaValues,
        string $names,
        string $types,
        string $funcType,
Severity: Minor
Found in src/Table/Search.php - About 6 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 getWhereClause has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function getWhereClause(
        mixed $criteriaValues,
        string $names,
        string $types,
        string $funcType,
Severity: Major
Found in src/Table/Search.php - About 2 hrs to fix

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

        private function generateWhereClause(): string
        {
            if (isset($_POST['customWhereClause']) && trim($_POST['customWhereClause']) != '') {
                return ' WHERE ' . $_POST['customWhereClause'];
            }
    Severity: Minor
    Found in src/Table/Search.php - About 1 hr to fix

      Method getWhereClause has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              mixed $criteriaValues,
              string $names,
              string $types,
              string $funcType,
              bool $unaryFlag,
      Severity: Minor
      Found in src/Table/Search.php - About 45 mins to fix

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

            public function buildSqlQuery(): string
            {
                $sqlQuery = 'SELECT ';
        
                // If only distinct values are needed
        Severity: Minor
        Found in src/Table/Search.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 generateWhereClause has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            private function generateWhereClause(): string
            {
                if (isset($_POST['customWhereClause']) && trim($_POST['customWhereClause']) != '') {
                    return ' WHERE ' . $_POST['customWhereClause'];
                }
        Severity: Minor
        Found in src/Table/Search.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 getGeomWhereClause has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                mixed $criteriaValues,
                string $names,
                string $funcType,
                string $types,
                string|null $geomFunc = null,
        Severity: Minor
        Found in src/Table/Search.php - About 35 mins to fix

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

              private function getGeomWhereClause(
                  mixed $criteriaValues,
                  string $names,
                  string $funcType,
                  string $types,
          Severity: Minor
          Found in src/Table/Search.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 getEnumWhereClause has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private function getEnumWhereClause(mixed $criteriaValues, string $funcType): string
              {
                  if (! is_array($criteriaValues)) {
                      $criteriaValues = explode(',', $criteriaValues);
                  }
          Severity: Minor
          Found in src/Table/Search.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