phpmyadmin/phpmyadmin

View on GitHub
src/Html/Generator.php

Summary

Maintainability
F
6 days
Test Coverage

File Generator.php has 741 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * HTML Generator
 */

Severity: Major
Found in src/Html/Generator.php - About 1 day to fix

    Method getMessage has 183 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function getMessage(
            Message|string $message,
            string|null $sqlQuery = null,
            MessageType $type = MessageType::Notice,
        ): string {
    Severity: Major
    Found in src/Html/Generator.php - About 7 hrs to fix

      Function getMessage has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function getMessage(
              Message|string $message,
              string|null $sqlQuery = null,
              MessageType $type = MessageType::Notice,
          ): string {
      Severity: Minor
      Found in src/Html/Generator.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 linkOrButton has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function linkOrButton(
              string $urlPath,
              array|null $urlParams,
              string $message,
              string|array $tagParams = [],
      Severity: Minor
      Found in src/Html/Generator.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

      Method mysqlDie has 104 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function mysqlDie(
              string $serverMessage = '',
              string $sqlQuery = '',
              bool $isModifyLink = true,
              string $backUrl = '',
      Severity: Major
      Found in src/Html/Generator.php - About 4 hrs to fix

        Function mysqlDie has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function mysqlDie(
                string $serverMessage = '',
                string $sqlQuery = '',
                bool $isModifyLink = true,
                string $backUrl = '',
        Severity: Minor
        Found in src/Html/Generator.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 linkOrButton has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function linkOrButton(
                string $urlPath,
                array|null $urlParams,
                string $message,
                string|array $tagParams = [],
        Severity: Major
        Found in src/Html/Generator.php - About 2 hrs to fix

          Function getSupportedDatatypes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function getSupportedDatatypes(string $selected): string
              {
                  // NOTE: the SELECT tag is not included in this snippet.
                  $retval = '';
          
          
          Severity: Minor
          Found in src/Html/Generator.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 getDefaultFunctionForField has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function getDefaultFunctionForField(
                  string $trueType,
                  bool $firstTimestamp,
                  string|null $defaultValue,
                  string $extra,
          Severity: Minor
          Found in src/Html/Generator.php - About 1 hr to fix

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

                public static function getSupportedDatatypes(string $selected): string
                {
                    // NOTE: the SELECT tag is not included in this snippet.
                    $retval = '';
            
            
            Severity: Minor
            Found in src/Html/Generator.php - About 1 hr to fix

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

                  public static function getDefaultFunctionForField(
                      string $trueType,
                      bool $firstTimestamp,
                      string|null $defaultValue,
                      string $extra,
              Severity: Minor
              Found in src/Html/Generator.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 getListNavigator has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      int $count,
                      int $pos,
                      array $urlParams,
                      string $script,
                      string $frame,
              Severity: Major
              Found in src/Html/Generator.php - About 1 hr to fix

                Method getDefaultFunctionForField has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        string $trueType,
                        bool $firstTimestamp,
                        string|null $defaultValue,
                        string $extra,
                        bool $isNull,
                Severity: Major
                Found in src/Html/Generator.php - About 1 hr to fix

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

                          string $urlPath,
                          array|null $urlParams,
                          string $message,
                          string|array $tagParams = [],
                          string $target = '',
                  Severity: Minor
                  Found in src/Html/Generator.php - About 45 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if (
                                $trueType === 'timestamp'
                                && $firstTimestamp
                                && ($defaultValue === null || $defaultValue === '')
                                && $extra !== 'on update CURRENT_TIMESTAMP'
                    Severity: Major
                    Found in src/Html/Generator.php - About 40 mins to fix

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

                              string $icon,
                              string $alternate = '',
                              bool $forceText = false,
                              bool $menuIcon = false,
                              string $controlParam = 'ActionLinksMode',
                      Severity: Minor
                      Found in src/Html/Generator.php - About 35 mins to fix

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

                                string $serverMessage = '',
                                string $sqlQuery = '',
                                bool $isModifyLink = true,
                                string $backUrl = '',
                                bool $exit = true,
                        Severity: Minor
                        Found in src/Html/Generator.php - About 35 mins to fix

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

                              public static function getStartAndNumberOfRowsFieldsetData(string $sqlQuery): array
                              {
                                  if (isset($_REQUEST['session_max_rows'])) {
                                      $rows = (int) $_REQUEST['session_max_rows'];
                                  } elseif (isset($_SESSION['tmpval']['max_rows']) && $_SESSION['tmpval']['max_rows'] !== 'all') {
                          Severity: Minor
                          Found in src/Html/Generator.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 getServerSSL has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function getServerSSL(): string
                              {
                                  $config = Config::getInstance();
                                  $server = $config->selectedServer;
                                  $class = 'text-danger';
                          Severity: Minor
                          Found in src/Html/Generator.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 getIcon has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function getIcon(
                                  string $icon,
                                  string $alternate = '',
                                  bool $forceText = false,
                                  bool $menuIcon = false,
                          Severity: Minor
                          Found in src/Html/Generator.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 getImage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function getImage(string $image, string $alternate = '', array $attributes = []): string
                              {
                                  $alternate = htmlspecialchars($alternate);
                          
                                  if (isset($attributes['class'])) {
                          Severity: Minor
                          Found in src/Html/Generator.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