web/lib/admin/OptionDisplay.php

Summary

Maintainability
D
1 day
Test Coverage

File OptionDisplay.php has 336 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/*
 * *****************************************************************************
 * Contributions to this work were made on behalf of the GÉANT project, a 
Severity: Minor
Found in web/lib/admin/OptionDisplay.php - About 4 hrs to fix

    Method prefillText has 69 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function prefillText(int $rowid, string $optionName, string $optionValue, $optionLang)
        {
            \core\common\Entity::intoThePotatoes();
            $retval = "";
            $optioninfo = \core\Options::instance();
    Severity: Major
    Found in web/lib/admin/OptionDisplay.php - About 2 hrs to fix

      Method selectElement has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function selectElement($rowid, $list)
          {
              $jsmagic = "onchange='
                                     if (/#ML#/.test(document.getElementById(\"option-S" . $rowid . "-select\").value)) {
                                         document.getElementById(\"S$rowid-input-langselect\").style.display = \"block\";
      Severity: Major
      Found in web/lib/admin/OptionDisplay.php - About 2 hrs to fix

        Function prefillText has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            private function prefillText(int $rowid, string $optionName, string $optionValue, $optionLang)
            {
                \core\common\Entity::intoThePotatoes();
                $retval = "";
                $optioninfo = \core\Options::instance();
        Severity: Minor
        Found in web/lib/admin/OptionDisplay.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 enumerateOptionsToDisplay has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function enumerateOptionsToDisplay($class, $fed)
            {
                $optioninfo = \core\Options::instance();
        
                $list = $optioninfo->availableOptions($class);
        Severity: Minor
        Found in web/lib/admin/OptionDisplay.php - About 1 hr to fix

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

              public static function enumerateOptionsToDisplay($class, $fed)
              {
                  $optioninfo = \core\Options::instance();
          
                  $list = $optioninfo->availableOptions($class);
          Severity: Minor
          Found in web/lib/admin/OptionDisplay.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 selectElement has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private function selectElement($rowid, $list)
              {
                  $jsmagic = "onchange='
                                         if (/#ML#/.test(document.getElementById(\"option-S" . $rowid . "-select\").value)) {
                                             document.getElementById(\"S$rowid-input-langselect\").style.display = \"block\";
          Severity: Minor
          Found in web/lib/admin/OptionDisplay.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 prefilledOptionTable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function prefilledOptionTable(string $attributePrefix, $fed)
              {
                  $retval = "<table id='expandable_$attributePrefix" . "_options'>";
          
                  $prepopulate = [];
          Severity: Minor
          Found in web/lib/admin/OptionDisplay.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 optiontext has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function optiontext(array $list, string $prefillValue = NULL, string $prefillLang = NULL)
              {
                  $rowid = mt_rand();
          
                  $retval = "<tr id='option-S$rowid' style='vertical-align:top'>";
          Severity: Minor
          Found in web/lib/admin/OptionDisplay.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