web/lib/admin/UIElements.php

Summary

Maintainability
F
3 days
Test Coverage

File UIElements.php has 439 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 6 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 65 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

        Method previewCAinHTML has 59 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);
                $caExpiryTrashhold = \config\ConfAssistant::CERT_WARNINGS['expiry_warning'];
        Severity: Major
        Found in web/lib/admin/UIElements.php - About 2 hrs to fix

          UIElements has 22 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class UIElements extends \core\common\Entity {
          
              /**
               * the custom displayable variant of the term 'federation'
               * 
          Severity: Minor
          Found in web/lib/admin/UIElements.php - About 2 hrs to fix

            Function previewCAinHTML has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                public function previewCAinHTML($cAReference) {
                    \core\common\Entity::intoThePotatoes();
                    $validator = new \web\lib\common\InputValidation();
                    $ref = $validator->databaseReference($cAReference);
                    $caExpiryTrashhold = \config\ConfAssistant::CERT_WARNINGS['expiry_warning'];
            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

            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 boxFlexible has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function boxFlexible(int $level, string $text = NULL, string $caption = NULL, bool $omittabletags = FALSE) {
                        \core\common\Entity::intoThePotatoes();
                        $uiMessages = [
                            \core\common\Entity::L_OK => ['img' => 'Tabler/square-rounded-check-filled-green.svg', 'text' => _("OK")],
                            \core\common\Entity::L_REMARK => ['img' => 'Tabler/info-square-rounded-filled-blue.svg', 'text' => _("Remark")],
                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