Function getSummary
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private function getSummary(Array $assignments)
{
// Create the summary array for this set of assignments and initialize it
$summary = array();
$this->initializeArray($summary);
- Read upRead up
- Create a ticketCreate a ticket
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 calcGrandTotals
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function calcGrandTotals()
{
foreach($this->hallSummaries as $hall){
foreach($this->studentTypes as $t){
// handle the 'other' type and skip the other types
- Read upRead up
- Create a ticketCreate a ticket
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 getSummary
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getSummary(Array $assignments)
{
// Create the summary array for this set of assignments and initialize it
$summary = array();
$this->initializeArray($summary);
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if(!isset($type) || $type === NULL ||
($type != TYPE_FRESHMEN && $type != TYPE_TRANSFER && $type != TYPE_CONTINUING && $type != TYPE_READMIT && $type != TYPE_RETURNING)) {
//$this->problems[] = $assign['asu_username'] . ': Type is unrecognized ('. $type .')';
$summary['OTHER']++;
continue;
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if(!isset($class) || $class === NULL ||
($class != CLASS_FRESHMEN && $class != CLASS_SOPHOMORE &&
$class != CLASS_JUNIOR && $class != CLASS_SENIOR)) {
//$this->problems[] = $assign['asu_username'] . ': Class is unrecognized ('. $class .')';
$summary['OTHER']++;
- Create a ticketCreate a ticket
Function initializeArray
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function initializeArray(Array &$arr)
{
// Initialize the multi-dimensional array
foreach($this->studentTypes as $t){
foreach($this->classes as $c){
- Read upRead up
- Create a ticketCreate a ticket
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"