phpmyadmin/phpmyadmin

View on GitHub
src/Config/FormDisplay.php

Summary

Maintainability
F
5 days
Test Coverage

File FormDisplay.php has 552 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Form management class, displays and processes forms
 *
 * Explanation of used terms:
Severity: Major
Found in src/Config/FormDisplay.php - About 1 day to fix

    Function save has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
    Open

        public function save(array $forms, bool $allowPartialSave = true): bool
        {
            $result = true;
            $values = [];
            $toSave = [];
    Severity: Minor
    Found in src/Config/FormDisplay.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 save has 118 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function save(array $forms, bool $allowPartialSave = true): bool
        {
            $result = true;
            $values = [];
            $toSave = [];
    Severity: Major
    Found in src/Config/FormDisplay.php - About 4 hrs to fix

      Method displayFieldInput has 111 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function displayFieldInput(
              Form $form,
              string $field,
              string $systemPath,
              string $workPath,
      Severity: Major
      Found in src/Config/FormDisplay.php - About 4 hrs to fix

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

            private function displayFieldInput(
                Form $form,
                string $field,
                string $systemPath,
                string $workPath,
        Severity: Minor
        Found in src/Config/FormDisplay.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 getDisplay has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getDisplay(
                bool $showButtons = true,
                string|null $formAction = null,
                array|null $hiddenFields = null,
            ): string {
        Severity: Major
        Found in src/Config/FormDisplay.php - About 2 hrs to fix

          Method setComments has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function setComments(string $systemPath, array &$opts): void
              {
                  // RecodingEngine - mark unavailable types
                  if ($systemPath === 'RecodingEngine') {
                      $comment = '';
          Severity: Minor
          Found in src/Config/FormDisplay.php - About 2 hrs to fix

            Function getDisplay has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getDisplay(
                    bool $showButtons = true,
                    string|null $formAction = null,
                    array|null $hiddenFields = null,
                ): string {
            Severity: Minor
            Found in src/Config/FormDisplay.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

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

                private function setComments(string $systemPath, array &$opts): void
                {
                    // RecodingEngine - mark unavailable types
                    if ($systemPath === 'RecodingEngine') {
                        $comment = '';
            Severity: Minor
            Found in src/Config/FormDisplay.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

            Function validate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                private function validate(): void
                {
                    if ($this->isValidated) {
                        return;
                    }
            Severity: Minor
            Found in src/Config/FormDisplay.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 displayFieldInput has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    Form $form,
                    string $field,
                    string $systemPath,
                    string $workPath,
                    string $translatedPath,
            Severity: Major
            Found in src/Config/FormDisplay.php - About 50 mins to fix

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

                  private function validateSelect(string|bool &$value, array $allowed): bool
                  {
                      $valueCmp = is_bool($value)
                          ? (int) $value
                          : $value;
              Severity: Minor
              Found in src/Config/FormDisplay.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