web/lib/admin/UIElements.php

Summary

Maintainability
D
2 days
Test Coverage

File UIElements.php has 369 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/UIElements.php - About 4 hrs to fix

    Function infoblock has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        public function infoblock(array $optionlist, string $class, string $level) {
            \core\common\Entity::intoThePotatoes();
            $locationMarkers = [];
            $retval = "";
            $optioninfo = \core\Options::instance();
    Severity: Minor
    Found in web/lib/admin/UIElements.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 displayName has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function displayName($input) {
            \core\common\Entity::intoThePotatoes();
            $ssidText = _("SSID");
            $passpointOiText = _("HS20 Consortium OI");
    
    
    Severity: Major
    Found in web/lib/admin/UIElements.php - About 2 hrs to fix

      Method infoblock has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function infoblock(array $optionlist, string $class, string $level) {
              \core\common\Entity::intoThePotatoes();
              $locationMarkers = [];
              $retval = "";
              $optioninfo = \core\Options::instance();
      Severity: Major
      Found in web/lib/admin/UIElements.php - About 2 hrs to fix

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

            public static function getBlobFromDB($table, $rowindex, $checkpublic) {
                // the data is either public (just give it away) or not; in this case, only
                // release if the data belongs to admin himself
                if ($checkpublic) {
        
        
        Severity: Minor
        Found in web/lib/admin/UIElements.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 pngInjectConsortiumLogo has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function pngInjectConsortiumLogo(string $inputpngstring, int $symbolsize, int $marginsymbols = 4) {
                $loggerInstance = new \core\common\Logging();
                $inputgd = imagecreatefromstring($inputpngstring);
                if ($inputgd === FALSE) { // source image is bogus; don't do anything
                    return "";
        Severity: Minor
        Found in web/lib/admin/UIElements.php - About 1 hr to fix

          Method instLevelInfoBoxes has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function instLevelInfoBoxes(\core\IdP $myInst) {
                  \core\common\Entity::intoThePotatoes();
                  $idpoptions = $myInst->getAttributes();
                  $retval = "<div class='infobox'>
                  <h2>" . sprintf(_("General %s details"), $this->nomenclatureParticipant) . "</h2>
          Severity: Minor
          Found in web/lib/admin/UIElements.php - About 1 hr to fix

            Method previewCAinHTML has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function previewCAinHTML($cAReference) {
                    \core\common\Entity::intoThePotatoes();
                    $validator = new \web\lib\common\InputValidation();
                    $ref = $validator->databaseReference($cAReference);
                    $rawResult = UIElements::getBlobFromDB($ref['table'], $ref['rowindex'], FALSE);
            Severity: Minor
            Found in web/lib/admin/UIElements.php - About 1 hr to fix

              Method sanityTestResultHTML has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function sanityTestResultHTML($test) {
                      $out = '';
                      switch ($test->test_result['global']) {
                          case \core\common\Entity::L_OK:
                              $message = "Your configuration appears to be fine.";
              Severity: Minor
              Found in web/lib/admin/UIElements.php - About 1 hr to fix

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

                    public function sanityTestResultHTML($test) {
                        $out = '';
                        switch ($test->test_result['global']) {
                            case \core\common\Entity::L_OK:
                                $message = "Your configuration appears to be fine.";
                Severity: Minor
                Found in web/lib/admin/UIElements.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

                There are no issues that match your filters.

                Category
                Status