AppStateESS/homestead

View on GitHub
class/HMS_Assignment.php

Summary

Maintainability
F
4 days
Test Coverage

File HMS_Assignment.php has 467 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Homestead;

use \Homestead\Exception\DatabaseException;
Severity: Minor
Found in class/HMS_Assignment.php - About 7 hrs to fix

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.
Severity: Minor
Found in class/HMS_Assignment.php - About 6 hrs to fix

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);
Severity: Minor
Found in class/HMS_Assignment.php - About 5 hrs to fix

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.
Severity: Major
Found in class/HMS_Assignment.php - About 4 hrs to fix

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;
Severity: Minor
Found in class/HMS_Assignment.php - About 3 hrs to fix

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);
Severity: Major
Found in class/HMS_Assignment.php - About 2 hrs to fix

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.');
        }
Severity: Minor
Found in class/HMS_Assignment.php - About 2 hrs to fix

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.');
        }
Severity: Major
Found in class/HMS_Assignment.php - About 2 hrs to fix

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)
Severity: Major
Found in class/HMS_Assignment.php - About 50 mins to fix

Method unassignStudent has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public static function unassignStudent(Student $student, $term, $notes = "", $reason, $refund)
Severity: Minor
Found in class/HMS_Assignment.php - About 35 mins to fix

There are no issues that match your filters.

Category
Status