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
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
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!"));
- Read upRead up
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!"));
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!"));
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) {
- Read upRead up
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)) {
- Read upRead up
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"