Function sanitiseInputs
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
private function sanitiseInputs(array $listOfEntries) {
$retval = [];
$bad = [];
$multilangAttrsWithC = [];
foreach ($listOfEntries as $objId => $objValueRaw) {
- 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
File OptionParser.php
has 365 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* *****************************************************************************
* Contributions to this work were made on behalf of the GÉANT project, a
Function postProcessValidAttributes
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
private function postProcessValidAttributes(array $options, array &$good, array &$bad) {
foreach ($options as $index => $iterateOption) {
foreach ($iterateOption as $name => $optionPayload) {
switch ($name) {
case "eap:ca_url": // eap:ca_url becomes eap:ca_file by downloading the file
- 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 sanitiseInputs
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function sanitiseInputs(array $listOfEntries) {
$retval = [];
$bad = [];
$multilangAttrsWithC = [];
foreach ($listOfEntries as $objId => $objValueRaw) {
Method furtherStringChecks
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function furtherStringChecks($attribute, $previsionalContent, &$bad) {
$content = FALSE;
switch ($attribute) {
case "media:consortium_OI":
$content = $this->validator->consortiumOI($previsionalContent);
Function sendOptionsToDatabase
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function sendOptionsToDatabase($object, array $options, array $pendingattributes, string $device = NULL, int $eaptype = NULL) {
$retval = [];
foreach ($options as $iterateOption) {
foreach ($iterateOption as $name => $optionPayload) {
$optiontype = $this->optioninfoObject->optionType($name);
- 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 checkUploadSanity
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function checkUploadSanity(string $optiontype, string $incomingBinary) {
switch ($optiontype) {
case "general:logo_file":
case "fed:logo_file":
case "internal:logo_from_url":
Method postProcessValidAttributes
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function postProcessValidAttributes(array $options, array &$good, array &$bad) {
foreach ($options as $index => $iterateOption) {
foreach ($iterateOption as $name => $optionPayload) {
switch ($name) {
case "eap:ca_url": // eap:ca_url becomes eap:ca_file by downloading the file
Function checkUploadSanity
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function checkUploadSanity(string $optiontype, string $incomingBinary) {
switch ($optiontype) {
case "general:logo_file":
case "fed:logo_file":
case "internal:logo_from_url":
- 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 furtherStringChecks
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function furtherStringChecks($attribute, $previsionalContent, &$bad) {
$content = FALSE;
switch ($attribute) {
case "media:consortium_OI":
$content = $this->validator->consortiumOI($previsionalContent);
- 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 sendOptionsToDatabase
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function sendOptionsToDatabase($object, array $options, array $pendingattributes, string $device = NULL, int $eaptype = NULL) {
$retval = [];
foreach ($options as $iterateOption) {
foreach ($iterateOption as $name => $optionPayload) {
$optiontype = $this->optioninfoObject->optionType($name);
Method sendOptionsToDatabase
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private function sendOptionsToDatabase($object, array $options, array $pendingattributes, string $device = NULL, int $eaptype = NULL) {
Method processSubmittedFields
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function processSubmittedFields($object, array $postArray, array $filesArray, int $eaptype = NULL, string $device = NULL) {
Avoid too many return
statements within this method. Open
return ['result'=>FALSE, 'details'=>_("incorrect file type - must be UTF8 text")];
Avoid too many return
statements within this method. Open
return ['result'=>TRUE, 'details'=>''];
Avoid too many return
statements within this method. Open
return FALSE;
Avoid too many return
statements within this method. Open
return ['result'=>TRUE, ''];
Avoid too many return
statements within this method. Open
return $content;
Avoid too many return
statements within this method. Open
return ['result'=>FALSE, 'details'=>''];
Avoid too many return
statements within this method. Open
return ['result'=>FALSE, 'details'=>''];
Avoid too many return
statements within this method. Open
return FALSE;
Avoid too many return
statements within this method. Open
return ['result'=>FALSE, 'details'=>''];
Avoid too many return
statements within this method. Open
return FALSE;