web/lib/common/InputValidation.php

Summary

Maintainability
D
1 day
Test Coverage

File InputValidation.php has 370 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/common/InputValidation.php - About 4 hrs to fix

    InputValidation has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class InputValidation extends \core\common\Entity
    {
    
        /**
         * returns a simple HTML <p> element with basic explanations about what was
    Severity: Minor
    Found in web/lib/common/InputValidation.php - About 3 hrs to fix

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

          public function existingIdPInt($input, $owner = NULL, $claimedFedBinding = NULL)
          {
              $clean = $this->integer($input);
              if ($clean === FALSE) {
                  throw new Exception($this->inputValidationError("Value for IdP is not an integer!"));
      Severity: Minor
      Found in web/lib/common/InputValidation.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 realm has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function realm($input)
          {
              \core\common\Entity::intoThePotatoes();
              if (strlen($input) == 0) {
                  echo $this->inputValidationError(_("Realm is empty!"));
      Severity: Minor
      Found in web/lib/common/InputValidation.php - About 1 hr to fix

        Method existingIdPInt has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function existingIdPInt($input, $owner = NULL, $claimedFedBinding = NULL)
            {
                $clean = $this->integer($input);
                if ($clean === FALSE) {
                    throw new Exception($this->inputValidationError("Value for IdP is not an integer!"));
        Severity: Minor
        Found in web/lib/common/InputValidation.php - About 1 hr to fix

          Function string has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function string($input, $allowWhitespace = FALSE)
              {
                  // always chop out invalid characters, and surrounding whitespace
                  $retvalStep0 = iconv("UTF-8", "UTF-8//TRANSLIT", $input);
                  if ($retvalStep0 === FALSE) {
          Severity: Minor
          Found in web/lib/common/InputValidation.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 existingFederationInt has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function existingFederationInt($input, $owner = NULL)
              {
                  $cat = new \core\CAT(); // initialises Entity static members
                  $fedIdentifiers = array_keys($cat->knownFederations);
                  if (!in_array(strtoupper($input), $fedIdentifiers)) {
          Severity: Minor
          Found in web/lib/common/InputValidation.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