phpmyadmin/phpmyadmin

View on GitHub
src/Plugins.php

Summary

Maintainability
F
3 days
Test Coverage

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

    private static function getOneOption(
        string $section,
        string $pluginName,
        OptionsPropertyItem $propertyGroup,
        bool $isSubgroup = false,
Severity: Minor
Found in src/Plugins.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

File Plugins.php has 416 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

namespace PhpMyAdmin;
Severity: Minor
Found in src/Plugins.php - About 6 hrs to fix

    Method getHtmlForProperty has 131 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function getHtmlForProperty(
            string $section,
            string $pluginName,
            OptionsPropertyItem $propertyItem,
        ): string {
    Severity: Major
    Found in src/Plugins.php - About 5 hrs to fix

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

          private static function getOneOption(
              string $section,
              string $pluginName,
              OptionsPropertyItem $propertyGroup,
              bool $isSubgroup = false,
      Severity: Major
      Found in src/Plugins.php - About 2 hrs to fix

        Function getOptions has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function getOptions(string $section, array $list): string
            {
                $ret = '';
                // Options for plugins that support them
                foreach ($list as $plugin) {
        Severity: Minor
        Found in src/Plugins.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 getPlugins has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            private static function getPlugins(string $type): array
            {
                try {
                    $files = new FilesystemIterator(ROOT_PATH . 'src/Plugins/' . $type);
                } catch (Throwable) {
        Severity: Minor
        Found in src/Plugins.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 getHtmlForProperty has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function getHtmlForProperty(
                string $section,
                string $pluginName,
                OptionsPropertyItem $propertyItem,
            ): string {
        Severity: Minor
        Found in src/Plugins.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 getPlugins has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private static function getPlugins(string $type): array
            {
                try {
                    $files = new FilesystemIterator(ROOT_PATH . 'src/Plugins/' . $type);
                } catch (Throwable) {
        Severity: Minor
        Found in src/Plugins.php - About 1 hr to fix

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

              public static function getOptions(string $section, array $list): string
              {
                  $ret = '';
                  // Options for plugins that support them
                  foreach ($list as $plugin) {
          Severity: Minor
          Found in src/Plugins.php - About 1 hr to fix

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

                public static function getDefault(string $section, string $opt): string
                {
                    if (isset($_GET[$opt])) {
                        // If the form is being repopulated using $_GET data, that is priority
                        return htmlspecialchars($_GET[$opt]);
            Severity: Minor
            Found in src/Plugins.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

            Avoid too many return statements within this method.
            Open

                    return htmlspecialchars($val);
            Severity: Major
            Found in src/Plugins.php - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status