File HMS_Assignment.php
has 467 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Homestead;
use \Homestead\Exception\DatabaseException;
- Create a ticketCreate a ticket
Function assignStudent
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
public static function assignStudent(Student $student, $term, $room_id = NULL, $bed_id = NULL, $notes = "", $lottery = FALSE, $reason)
{
/**
* Can't check permissions here because there are some student-facing commands that needs to make assignments (e.g.
- 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 moveAssignments
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
public static function moveAssignments(Array $students, $term)
{
// Update the assignments in Banner through the Web Service
$soap = SOAP::getInstance(UserStatus::getUsername(), SOAP::ADMIN_USER);
$soap->moveRoomAssignment($students, $term);
- 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 assignStudent
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function assignStudent(Student $student, $term, $room_id = NULL, $bed_id = NULL, $notes = "", $lottery = FALSE, $reason)
{
/**
* Can't check permissions here because there are some student-facing commands that needs to make assignments (e.g.
- Create a ticketCreate a ticket
HMS_Assignment
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class HMS_Assignment extends HMS_Item {
public $asu_username = null;
public $banner_id;
public $bed_id = 0;
- Create a ticketCreate a ticket
Method moveAssignments
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function moveAssignments(Array $students, $term)
{
// Update the assignments in Banner through the Web Service
$soap = SOAP::getInstance(UserStatus::getUsername(), SOAP::ADMIN_USER);
$soap->moveRoomAssignment($students, $term);
- Create a ticketCreate a ticket
Function unassignStudent
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function unassignStudent(Student $student, $term, $notes = "", $reason, $refund)
{
if (!UserStatus::isAdmin() || !\Current_User::allow('hms', 'assignment_maintenance')) {
throw new PermissionException('You do not have permission to unassign students.');
}
- 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 unassignStudent
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function unassignStudent(Student $student, $term, $notes = "", $reason, $refund)
{
if (!UserStatus::isAdmin() || !\Current_User::allow('hms', 'assignment_maintenance')) {
throw new PermissionException('You do not have permission to unassign students.');
}
- Create a ticketCreate a ticket
Method assignStudent
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function assignStudent(Student $student, $term, $room_id = NULL, $bed_id = NULL, $notes = "", $lottery = FALSE, $reason)
- Create a ticketCreate a ticket
Method unassignStudent
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function unassignStudent(Student $student, $term, $notes = "", $reason, $refund)
- Create a ticketCreate a ticket