class/HMS_Util.php
File HMS_Util.php
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
namespace Homestead;
/**
- Create a ticketCreate a ticket
HMS_Util
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class HMS_Util{
/**
* Returns an array where the keys are numeric 1-12, values are text month names
*/
- Create a ticketCreate a ticket
Function ordinal
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
public static function ordinal($number) {
if ($number % 100 > 10 && $number %100 < 14){
$suffix = "th";
}else{
switch($number % 10) {
- 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 get_hours
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
public static function get_hours(){
$hours = array();
$hours[0] = '12 AM';
- 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
Avoid too many return
statements within this method. Open
Open
return 'Unknown';
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
Open
return "Unrecognized: $type";
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
Open
return 'Returning';
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
Open
return 'Re-admit';
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
Open
return 'Summer (5 weeks)';
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
Open
return 'Error: Unknown gender';
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
Open
return 'Super';
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
Open
return 'Unknown';
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
Open
return 'High';
- Create a ticketCreate a ticket