Function getAttributes
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getAttributes(string $optionName = NULL, string $omittedOptionName = NULL)
{
if ($optionName !== NULL) {
if ($optionName === $omittedOptionName) {
throw new Exception("The attibute to be shown has the same name as that to be omitted");
- 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 isDataRestricted
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function isDataRestricted($table, $row_id)
{
if ($table != "institution_option" && $table != "profile_option" && $table != "federation_option" && $table != "user_options") {
return []; // better safe than sorry: that's an error, so assume nobody is authorised to act on that data
}
Function isDataRestricted
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function isDataRestricted($table, $row_id)
{
if ($table != "institution_option" && $table != "profile_option" && $table != "federation_option" && $table != "user_options") {
return []; // better safe than sorry: that's an error, so assume nobody is authorised to act on that data
}
- 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 levelPrecedenceAttributeJoin
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function levelPrecedenceAttributeJoin($existing, $new, $newlevel)
{
foreach ($new as $attrib) {
$ignore = "";
foreach ($existing as $approvedAttrib) {
- 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
Avoid too many return
statements within this method. Open
return FALSE;
Avoid too many return
statements within this method. Open
return $inst->listOwners();
Avoid too many return
statements within this method. Open
return []; // better safe than sorry: that's an error, so assume nobody is authorised to act on that data
Avoid too many return
statements within this method. Open
return [];