AppStateESS/homestead

View on GitHub
class/HMS_Util.php

Summary

Maintainability
C
1 day
Test Coverage

File HMS_Util.php has 258 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Homestead;

/**
Severity: Minor
Found in class/HMS_Util.php - About 2 hrs to fix

HMS_Util has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class HMS_Util{

    /**
     * Returns an array where the keys are numeric 1-12, values are text month names
     */
Severity: Minor
Found in class/HMS_Util.php - About 2 hrs to fix

Function ordinal has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function ordinal($number) {
        if ($number % 100 > 10 && $number %100 < 14){
            $suffix = "th";
        }else{
            switch($number % 10) {
Severity: Minor
Found in class/HMS_Util.php - About 55 mins 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 get_hours has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function get_hours(){
        $hours = array();

        $hours[0] = '12 AM';

Severity: Minor
Found in class/HMS_Util.php - About 35 mins 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

Avoid too many return statements within this method.
Open

                return 'Unknown';
Severity: Major
Found in class/HMS_Util.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return "Unrecognized: $type";
Severity: Major
Found in class/HMS_Util.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return 'Returning';
Severity: Major
Found in class/HMS_Util.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return 'Re-admit';
Severity: Major
Found in class/HMS_Util.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return 'Summer (5 weeks)';
Severity: Major
Found in class/HMS_Util.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return 'Error: Unknown gender';
Severity: Major
Found in class/HMS_Util.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return 'Super';
Severity: Major
Found in class/HMS_Util.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return 'Unknown';
Severity: Major
Found in class/HMS_Util.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return 'High';
Severity: Major
Found in class/HMS_Util.php - About 30 mins to fix

There are no issues that match your filters.

Category
Status